Author: poeml Date: 2009-02-21 08:04:29 -0700 (Sat, 21 Feb 2009) New Revision: 6523 Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl Log: MirrorBrain scanner: - adjust for the removal of timestamp_file column - fix printing of database error strings Modified: trunk/tools/download-redirector-v2/scanner/scanner.pl =================================================================== --- trunk/tools/download-redirector-v2/scanner/scanner.pl 2009-02-21 15:03:04 UTC (rev 6522) +++ trunk/tools/download-redirector-v2/scanner/scanner.pl 2009-02-21 15:04:29 UTC (rev 6523) _at_@ -240,7 +240,7 @@ my $sql = qq{SELECT * FROM server where country != '**'}; print "$sql\n" if $sqlverbose; my $ary_ref = $dbh->selectall_hashref($sql, 'id') - or die $dbh->errstr(); + or die $DBI::errstr; my _at_scan_list; _at_@ -335,21 +335,21 @@ # Keep in sync with $start_dir setup above! my $sth = $dbh->prepare( $sql ); print "$sql <--- " . length($start_dir) ? "$start_dir/%" : () . " \n" if $sqlverbose; - $sth->execute(length($start_dir) ? "$start_dir/%" : ()) or die "$row->{identifier}: $sth->errstr"; + $sth->execute(length($start_dir) ? "$start_dir/%" : ()) or die "$row->{identifier}: $DBI::errstr"; } unless ($extra_schedule_run) { $sql = "UPDATE server SET last_scan = NOW(), scan_fpm = $fpm WHERE id = $row->{id};"; print "$sql\n" if $sqlverbose; my $sth = $dbh->prepare( $sql ); - $sth->execute() or die "$row->{identifier}: $sth->errstr"; + $sth->execute() or die "$row->{identifier}: $DBI::errstr"; } if($enable_after_scan && $file_count > 1 && !$row->{enabled}) { $sql = "UPDATE server SET enabled = '1' WHERE id = $row->{id};"; print "$sql\n" if $sqlverbose; my $sth = $dbh->prepare( $sql ); - $sth->execute() or die "$row->{identifier}: $sth->errstr"; + $sth->execute() or die "$row->{identifier}: $DBI::errstr"; print "$row->{identifier}: now enabled.\n" if $verbose > 0; } _at_@ -502,7 +502,7 @@ " WHERE id = $old->[0]{id}"; print "$sql\n" if $sqlverbose; - $dbh->do($sql) or die "$sql: ".$dbh->errstr; + $dbh->do($sql) or die "$sql: ".$DBI::errstr; } else { $fields->{identifier} ||= $name||''; _at_@ -524,7 +524,7 @@ join(', ', map { "$_ = ".$dbh->quote($fields->{$_}) } keys %$fields); print "$sql\n" if $sqlverbose; - $dbh->do($sql) or die "$sql: ".$dbh->errstr; + $dbh->do($sql) or die "$sql: ".$DBI::errstr; } return 0; } _at_@ -751,7 +751,7 @@ sub save_file { - my ($path, $identifier, $serverid, $file_tstamp, $mod_re, $ign_re) = _at__; + my ($path, $identifier, $serverid, $mod_re, $ign_re) = _at__; my $fileid; _at_@ -777,24 +777,26 @@ 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_file = FROM_UNIXTIME(?), timestamp_scanner = NOW() WHERE fileid = ? AND serverid = ?;"; + my $sql = "UPDATE file_server SET timestamp_scanner = NOW() WHERE fileid = ? AND serverid = ?;"; if (!defined $sth_update) { printf "\nPreparing update statement\n\n" if $sqlverbose; - $sth_update = $dbh->prepare( $sql ); + $sth_update = $dbh->prepare( $sql ) or die $DBI::errstr; } - printf "$sql <-- $file_tstamp, $fileid, $serverid \n" if $sqlverbose; - $sth_update->execute( $file_tstamp, $fileid, $serverid ) or die "$identifier: $sth_update->errstr"; + printf "$sql <-- $fileid, $serverid \n" if $sqlverbose; + $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_file, timestamp_scanner) VALUES (?, ?, FROM_UNIXTIME(?), NOW());"; + my $sql = "INSERT INTO file_server (fileid, serverid, timestamp_scanner) VALUES (?, ?, NOW());"; if (!defined $sth_insert_rel) { printf "\nPreparing insert statement\n\n" if $sqlverbose; $sth_insert_rel = $dbh->prepare( $sql ); } - printf "$sql <-- $fileid, $serverid, $file_tstamp \n" if $sqlverbose; - $sth_insert_rel->execute( $fileid, $serverid, $file_tstamp ) or die "$identifier: $sth_insert_rel->errstr"; + printf "$sql <-- $fileid, $serverid \n" if $sqlverbose; + $sth_insert_rel->execute( $fileid, $serverid ) or die "$identifier: $sth_insert_rel->errstr"; } return $path; } _______________________________________________ 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 Sat Feb 21 2009 - 15:05:09 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT