X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=perl%2FSesse%2Fpr0n%2FCommon.pm;h=6fb5536f5911e312034042b57a1f73f379bef3b3;hb=2a2ae1a7b053e44aa7963b5103d7647a7a83fcec;hp=20dacfb49db4602bb711ccd89a844b0d532f4b6f;hpb=56429e6ffe41a5cd7eff61e7f770f956973f8a42;p=pr0n diff --git a/perl/Sesse/pr0n/Common.pm b/perl/Sesse/pr0n/Common.pm index 20dacfb..6fb5536 100644 --- a/perl/Sesse/pr0n/Common.pm +++ b/perl/Sesse/pr0n/Common.pm @@ -34,7 +34,7 @@ BEGIN { require Sesse::pr0n::Config_local; }; - $VERSION = "v2.30"; + $VERSION = "v2.40"; @ISA = qw(Exporter); @EXPORT = qw(&error &dberror); %EXPORT_TAGS = qw(); @@ -220,7 +220,7 @@ sub update_image_info { # update the last_picture cache as well (this should of course be done # via a trigger, but this is less complicated :-) ) - $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE event=(SELECT event FROM images WHERE id=?)', + $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) WHERE (vhost,event)=(SELECT vhost,event FROM images WHERE id=?)', undef, $datetime, $id) or die "Couldn't update last_picture in SQL: $!"; } @@ -444,6 +444,8 @@ sub make_infobox { my ($a, $b) = ($1, $2); my $gcd = gcd($a, $b); push @classic_fields, ($a/$gcd . "/" . $b/$gcd . "s"); + } elsif (defined($info->{'ExposureTime'}) && $info->{'ExposureTime'} =~ /^(\d+)$/) { + push @classic_fields, ($1 . "s"); } if (defined($info->{'FNumber'}) && $info->{'FNumber'} =~ /^(\d+)\/(\d+)$/) { my $f = $1/$2; @@ -571,11 +573,11 @@ sub add_new_event { return @errors; } - $dbh->do("INSERT INTO events (id,date,name,vhost) VALUES (?,?,?,?)", + $dbh->do("INSERT INTO events (event,date,name,vhost) VALUES (?,?,?,?)", undef, $id, $date, $desc, $vhost) or return ("Kunne ikke sette inn ny hendelse" . $dbh->errstr); - $dbh->do("INSERT INTO last_picture_cache (event,last_picture) VALUES (?,NULL)", - undef, $id) + $dbh->do("INSERT INTO last_picture_cache (vhost,event,last_picture) VALUES (?,?,NULL)", + undef, $vhost, $id) or return ("Kunne ikke sette inn ny cache-rad" . $dbh->errstr); return ();