X-Git-Url: https://git.sesse.net/?p=pr0n;a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FRotate.pm;h=c3769f532730cd43c3b037a705307e71d159b4eb;hp=923e5df1cc5149143569c1773f949eb9f347efbc;hb=fa10473159be03eb924e50cdb4688540c78f89b1;hpb=2d6536cab108c937e2af49f7dcf15f2230f44d1a diff --git a/perl/Sesse/pr0n/Rotate.pm b/perl/Sesse/pr0n/Rotate.pm index 923e5df..c3769f5 100644 --- a/perl/Sesse/pr0n/Rotate.pm +++ b/perl/Sesse/pr0n/Rotate.pm @@ -36,17 +36,24 @@ sub handler { if ($rotval == 90 || $rotval == 270) { my $q = $dbh->do('UPDATE images SET height=width,width=height WHERE id=?', undef, $id) - or dberror($r, "Size clear of $id failed: $!"); + or dberror($r, "Size clear of $id failed"); + $dbh->do('UPDATE events SET last_update=CURRENT_TIMESTAMP WHERE (vhost,event)=( SELECT vhost,event FROM images WHERE id=? )', + undef, $id) + or dberror($r, "Cache invalidation at $id failed"); } } elsif ($key =~ /^del-(\d+)$/ && $apr->param($key) eq 'on') { my $id = $1; { eval { + $dbh->do('UPDATE events SET last_update=CURRENT_TIMESTAMP WHERE (vhost,event)=( SELECT vhost,event FROM images WHERE id=? )', + undef, $id); $dbh->do('INSERT INTO deleted_images SELECT * FROM images WHERE id=?', - undef, $id); + undef, $id); + $dbh->do('DELETE FROM exif_info WHERE image=?', + undef, $id); $dbh->do('DELETE FROM images WHERE id=?', - undef, $id); + undef, $id); }; if ($@) { # Some error occurred, rollback and bomb out @@ -58,6 +65,10 @@ sub handler { } } } + + my $event = $apr->param('event'); + $dbh->do('UPDATE events SET last_update=CURRENT_TIMESTAMP WHERE vhost=? AND event=?', undef, $r->get_server_name, $event) + or dberror($r, "Cache invalidation failed"); Sesse::pr0n::Common::footer($r);