Author: poeml Date: Fri Nov 20 15:31:49 2009 New Revision: 7857 URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain?rev=7857&view=rev Log: scanner: remove dead code (from unused variable keep_dead_files) Modified: trunk/tools/scanner.pl Modified: trunk/tools/scanner.pl URL: http://svn.mirrorbrain.org/viewvc/mirrorbrain/trunk/tools/scanner.pl?rev=7857&r1=7856&r2=7857&view=diff ============================================================================== --- trunk/tools/scanner.pl (original) +++ trunk/tools/scanner.pl Fri Nov 20 15:31:49 2009 _at_@ -77,7 +77,6 @@ my $start_dir = '/'; my $parallel = 1; my $list_only = 0; -my $keep_dead_files = 0; my $recursion_delay = 0; # seconds delay per *_readdir recuursion my $force_scan = 0; my $enable_after_scan = 0; _at_@ -332,29 +331,28 @@ . int($fpm/60) . "/s) in " . int($duration) . "s\n" if $verbose; - unless ($keep_dead_files) { - $start = time(); - print localtime(time) . " $row->{identifier}: purging old files\n" if $verbose > 1; - - - #$sql = "SELECT COUNT(*) FROM temp1"; - $sql = "SELECT COUNT(mirr_del_byid($row->{id}, id)) FROM temp1"; - print "$sql\n" if $sqlverbose; - $ary_ref = $dbh->selectall_arrayref($sql) or die $dbh->errstr(); - my $purge_file_count = defined($ary_ref->[0]) ? $ary_ref->[0][0] : 0; - print localtime(time) . " $row->{identifier}: files to be purged: $purge_file_count\n"; - - - $sql = "SELECT COUNT(*) FROM filearr WHERE $row->{id} = ANY(mirrors);"; - print "$sql\n" if $sqlverbose; - my $ary_ref = $dbh->selectall_arrayref($sql) or die $dbh->errstr(); - $file_count = defined($ary_ref->[0]) ? $ary_ref->[0][0] : 0; - print localtime(time) . " $row->{identifier}: total files after scan: $file_count\n"; - - - $duration = time() - $start; - print localtime(time) . " $row->{identifier}: purged old files in " . $duration . "s.\n" if $verbose > 0; - } + $start = time(); + print localtime(time) . " $row->{identifier}: purging old files\n" if $verbose > 1; + + + #$sql = "SELECT COUNT(*) FROM temp1"; + $sql = "SELECT COUNT(mirr_del_byid($row->{id}, id)) FROM temp1"; + print "$sql\n" if $sqlverbose; + $ary_ref = $dbh->selectall_arrayref($sql) or die $dbh->errstr(); + my $purge_file_count = defined($ary_ref->[0]) ? $ary_ref->[0][0] : 0; + print localtime(time) . " $row->{identifier}: files to be purged: $purge_file_count\n"; + + + $sql = "SELECT COUNT(*) FROM filearr WHERE $row->{id} = ANY(mirrors);"; + print "$sql\n" if $sqlverbose; + my $ary_ref = $dbh->selectall_arrayref($sql) or die $dbh->errstr(); + $file_count = defined($ary_ref->[0]) ? $ary_ref->[0][0] : 0; + print localtime(time) . " $row->{identifier}: total files after scan: $file_count\n"; + + + $duration = time() - $start; + print localtime(time) . " $row->{identifier}: purged old files in " . $duration . "s.\n" if $verbose > 0; + # update the last_scan timestamp; but only if we did a complete scan. unless ($start_dir) { _at_@ -802,11 +800,10 @@ #print "fileid: $fileid\n"; #} $sth_mirr_addbypath->finish; - if (!$keep_dead_files) { - $sql = "DELETE FROM temp1 WHERE id = $fileid"; - print "$sql\n" if $sqlverbose; - $dbh->do($sql) or die "$sql: ".$DBI::errstr; - } + + $sql = "DELETE FROM temp1 WHERE id = $fileid"; + print "$sql\n" if $sqlverbose; + $dbh->do($sql) or die "$sql: ".$DBI::errstr; return $path; } _______________________________________________ mirrorbrain-commits mailing list Archive: http://mirrorbrain.org/archive/mirrorbrain-commits/ Note: To remove yourself from this list, send a mail with the content unsubscribe to the address mirrorbrain-commits-request_at_mirrorbrain.orgReceived on Fri Nov 20 2009 - 14:31:54 GMT
This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT