Author: poeml Date: 2009-02-21 12:14:28 -0700 (Sat, 21 Feb 2009) New Revision: 6528 Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl Log: scanner: - timestamp_scanner is a UNIX epoch now, which is a little smaller than an SQL timestamp. Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl =================================================================== --- trunk/tools/download-redirector-v2/scanner/scanner.pl 2009-02-21 18:04:32 UTC (rev 6527) +++ trunk/tools/download-redirector-v2/scanner/scanner.pl 2009-02-21 19:14:28 UTC (rev 6528) @@ -65,10 +65,9 @@ # considered obsolete. # 2009-02-03, poeml - V0.22, prepare SQL statements *once*. # add -S option for SQL debugging +# 2009-02-21, poeml - V0.23, timestamp_scanner is a UNIX epoch now, instead of +# a SQL timestamp. # -# FIXME: -# should do optimize table file, file_server; -# once in a while. # # ####################################################################### @@ -95,7 +94,7 @@ use bytes; use Config::IniFiles; -my $version = '0.22'; +my $version = '0.23'; my $scanner_email = 'poeml_at_suse.de'; my $verbose = 1; my $sqlverbose = 0; @@ -324,7 +323,7 @@ unless ($keep_dead_files) { my $sql = "DELETE FROM file_server WHERE serverid = $row->{id} - AND timestamp_scanner <= (SELECT last_scan FROM server + AND timestamp_scanner <= (SELECT extract(epoch from last_scan) FROM server WHERE id = $row->{id} limit 1)"; if(length $start_dir) { @@ -334,7 +333,7 @@ # Keep in sync with $start_dir setup above! my $sth = $dbh->prepare( $sql ); - print "$sql <--- " . length($start_dir) ? "$start_dir/%" : () . " \n" if $sqlverbose; + print "$row->{identifier}: $sql\n" if $sqlverbose; $sth->execute(length($start_dir) ? "$start_dir/%" : ()) or die "$row->{identifier}: $DBI::errstr"; } @@ -777,8 +776,7 @@ if(checkfileserver_fileid($serverid, $fileid)) { - #my $sql = "UPDATE file_server SET timestamp_file = FROM_UNIXTIME(?), timestamp_scanner = NOW() WHERE fileid = ? AND serverid = ?;"; - my $sql = "UPDATE file_server SET timestamp_scanner = NOW() WHERE fileid = ? AND serverid = ?;"; + my $sql = "UPDATE file_server SET timestamp_scanner = ".time." WHERE fileid = ? AND serverid = ?;"; if (!defined $sth_update) { printf "\nPreparing update statement\n\n" if $sqlverbose; $sth_update = $dbh->prepare( $sql ) or die $DBI::errstr; @@ -788,8 +786,7 @@ $sth_update->execute( $fileid, $serverid ) or die $DBI::errstr; } else { - #my $sql = "INSERT INTO file_server (fileid, serverid, timestamp_file, timestamp_scanner) VALUES (?, ?, FROM_UNIXTIME(?), NOW());"; - my $sql = "INSERT INTO file_server (fileid, serverid, timestamp_scanner) VALUES (?, ?, NOW());"; + my $sql = "INSERT INTO file_server (fileid, serverid, timestamp_scanner) VALUES (?, ?, ".time.");"; if (!defined $sth_insert_rel) { printf "\nPreparing insert statement\n\n" if $sqlverbose; $sth_insert_rel = $dbh->prepare( $sql ); _______________________________________________ Opensuse-svn mailing list Opensuse-svn_at_forge.novell.com http://forge.novell.com/mailman/listinfo/opensuse-svn _______________________________________________ mirrorbrain-commits mailing list Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on 2009-02-21Z19:15:11
This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:11 GMT