X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Fmaintenance%2Fremove_items_from_biblioitems.pl;h=9f30db05f36c127da0d7d6ea50971e6b03dff35e;hb=c508a8c1b3139a741c5e6efc3fe1cd1f55fa40e6;hp=0778b295ab2f5db8da333c9e7450e43f94ed2a7c;hpb=c2043933f7f9b30bf87a4c5656c50fd10584ef4f;p=koha_gimpoz diff --git a/misc/maintenance/remove_items_from_biblioitems.pl b/misc/maintenance/remove_items_from_biblioitems.pl index 0778b295ab..9f30db05f3 100755 --- a/misc/maintenance/remove_items_from_biblioitems.pl +++ b/misc/maintenance/remove_items_from_biblioitems.pl @@ -20,15 +20,17 @@ use strict; use warnings; +$|=1; use C4::Context; use C4::Biblio; use Getopt::Long; -my ($wherestring, $run, $want_help); +my ($wherestring, $run, $silent, $want_help); my $result = GetOptions( 'where:s' => \$wherestring, '--run' => \$run, + '--silent' => \$silent, 'help|h' => \$want_help, ); @@ -38,11 +40,15 @@ if ( not $result or not $run or $want_help ) { } my $dbh = C4::Context->dbh; +my $count = 0; my $querysth = qq{SELECT biblionumber from biblioitems }; $querysth .= " WHERE $wherestring " if ($wherestring); my $query = $dbh->prepare($querysth); $query->execute; while (my $biblionumber = $query->fetchrow){ + $count++; + print "." unless $silent; + print "\r$count" unless ($silent or ($count % 100)); my $record = GetMarcBiblio($biblionumber); if ($record) { @@ -53,6 +59,8 @@ while (my $biblionumber = $query->fetchrow){ } } +print "\n\n$count records processed.\n" unless $silent; + sub print_usage { print <<_USAGE_; $0: removes items from selected biblios @@ -66,6 +74,7 @@ should be run using rebuild_zebra.pl -b -r. Parameters: -where use this to limit modifications to selected biblios --run perform the update + --silent run silently --help or -h show this message _USAGE_ }