use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
use Exporter ();
our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
- our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")
+ our $dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+ $Sesse::pr0n::Config::db_username, $Sesse::pr0n::Config::db_password)
if (!(defined($dbh) && $dbh->ping)) {
# Try to reconnect
Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
if (!(defined($dbh) && $dbh->ping)) {
# Try to reconnect
Apache2::ServerUtil->server->log_error("Lost contact with PostgreSQL server, trying to reconnect...");
- unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=127.0.0.1", "pr0n", "EsVdwImY")) {
+ unless ($dbh = DBI->connect("dbi:Pg:dbname=pr0n;host=" . $Sesse::pr0n::Config::db_host,
+ $Sesse::pr0n::Config::db_user, $Sesse::pr0n::Config::db_password)) {
# update the last_picture cache as well (this should of course be done
# via a trigger, but this is less complicated :-) )
# update the last_picture cache as well (this should of course be done
# via a trigger, but this is less complicated :-) )
- $dbh->do('UPDATE events SET last_picture=(SELECT COALESCE(MAX(date),\'1970-01-01 00:00:00\') FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
- undef, $id)
+ $dbh->do('UPDATE last_picture_cache SET last_picture=GREATEST(last_picture, ?) FROM images WHERE event=events.id) WHERE id=(SELECT event FROM images WHERE id=?)',
+ undef, $datetime, $id)
my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
my $fname = get_disk_location($r, $id);
my ($r, $filename, $id, $dbwidth, $dbheight, $infobox, $xres, $yres, @otherres) = @_;
my $fname = get_disk_location($r, $id);