--- /dev/null
+use strict;
+use warnings;
+use POSIX;
+
+package wloh_common;
+
+sub output_last_sync {
+ my $dbh = shift;
+ my $ref = $dbh->selectrow_hashref('SELECT EXTRACT(EPOCH FROM last_sync) AS last_sync FROM last_sync');
+ if (!defined($ref)) {
+ print " <p class=\"lastsync\">Databasen ble sist synkronisert (ukjent).</p>\n";
+ } else {
+ my $ts = POSIX::strftime("%Y-%m-%d %H:%M %Z", localtime($ref->{'last_sync'}));
+ print " <p class=\"lastsync\">Databasen ble sist synkronisert $ts.</p>\n";
+ }
+}
+
+1;
sync_table($mdbh, $sdbh, 'Fotballtoppti');
sync_table($mdbh, $sdbh, 'Fotballvariabler');
+$sdbh->do('DELETE FROM last_sync');
+$sdbh->do('INSERT INTO last_sync VALUES ( CURRENT_TIMESTAMP );');
+
$mdbh->rollback();
$sdbh->commit();
use utf8;
use locale;
require '../config.pm';
+require '../common.pm';
my $cgi = CGI->new;
make_table($lowest_division, \%ratings, $cov);
+wloh_common::output_last_sync($dbh);
+
print <<"EOF";
</body>
</html>
use utf8;
use locale;
require '../config.pm';
+require '../common.pm';
my $dbh = DBI->connect($config::local_connstr, $config::local_username, $config::local_password)
or die "connect: " . $DBI::errstr;
printf " <td><a href=\"http://wordfeud.aasmul.net/serie-%d\">%s</a></td>\n", $ref->{'serie_id'}, $ref->{'serie_navn'};
print " </tr>\n";
}
+print " </table>\n";
+
+wloh_common::output_last_sync($dbh);
print <<"EOF";
- </table>
</body>
</html>
EOF
.even {
background-color: #ddd;
}
+.lastsync {
+ font-size: smaller;
+}