invalidate example
authorDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 8 Oct 2004 20:07:32 +0000 (20:07 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Fri, 8 Oct 2004 20:07:32 +0000 (20:07 +0000)
git-svn-id: svn://svn.rot13.org/fuse_dbi/trunk@25 17f4e80c-d0e0-0310-8903-bfc3ae804c12

examples/webgui-mysql.pl

index be64388..2c0be57 100755 (executable)
@@ -4,6 +4,8 @@ use strict;
 use blib;
 use Fuse::DBI;
 
 use blib;
 use Fuse::DBI;
 
+my $template_dir = '/data/WebGUI/cms.rot13.org/uploads/temp/templates';
+
 my $sql_filenames = q{
        select
                concat(templateid,name) as id,
 my $sql_filenames = q{
        select
                concat(templateid,name) as id,
@@ -35,6 +37,13 @@ my $mnt = Fuse::DBI->mount({
        user => 'webgui',
        password => 'webgui',
        mount => $mount,
        user => 'webgui',
        password => 'webgui',
        mount => $mount,
+       invalidate => sub {
+               print STDERR "invalidating content in $template_dir\n";
+               opendir(DIR, $template_dir) || die "can't opendir $template_dir: $!";
+               map { unlink "$template_dir/$_" || warn "can't remove $template_dir/$_: $!" } grep { !/^\./ && -f "$template_dir/$_" } readdir(DIR);
+               closedir DIR;
+       }
+
 });
 
 print "Press enter to exit...";
 });
 
 print "Press enter to exit...";