Invalidate the cache on adding and deleting images.
authorSteinar H. Gunderson <sesse@debian.org>
Mon, 25 Dec 2006 16:27:12 +0000 (17:27 +0100)
committerSteinar H. Gunderson <sesse@debian.org>
Mon, 25 Dec 2006 16:27:12 +0000 (17:27 +0100)
perl/Sesse/pr0n/WebDAV.pm

index 08f4c7ba57ca34b7e5eb53b201acc8a8c8ce5aa9..ee0280d2eff875c22f369931472eb87e6f3f7f4f 100644 (file)
@@ -466,6 +466,8 @@ EOF
                                        
                                $dbh->do('INSERT INTO images (id,event,uploadedby,takenby,filename) VALUES (?,?,?,?,?);',
                                        undef, $newid, $event, $user, $takenby, $filename);
                                        
                                $dbh->do('INSERT INTO images (id,event,uploadedby,takenby,filename) VALUES (?,?,?,?,?);',
                                        undef, $newid, $event, $user, $takenby, $filename);
+                               $dbh->do('UPDATE images SET last_update=CURRENT_TIMESTAMP WHERE event=?',
+                                       undef, $event);
 
                                # Now save the file to disk
                                $fname = Sesse::pr0n::Common::get_disk_location($r, $newid);
 
                                # Now save the file to disk
                                $fname = Sesse::pr0n::Common::get_disk_location($r, $newid);
@@ -578,6 +580,9 @@ EOF
                $dbh->do('DELETE FROM images WHERE event=? AND filename=?;',
                        undef, $event, $filename)
                        or dberror($r, "Couldn't remove file");
                $dbh->do('DELETE FROM images WHERE event=? AND filename=?;',
                        undef, $event, $filename)
                        or dberror($r, "Couldn't remove file");
+               $dbh->do('UPDATE images SET last_update=CURRENT_TIMESTAMP WHERE event=?',
+                       undef, $event)
+                       or dberror($r, "Couldn't invalidate cache");
                $r->status(200);
                $r->print("OK");
 
                $r->status(200);
                $r->print("OK");