[Koha-cvs] koha/misc/migration_tools rebuild_zebra.pl

paul poulain paul at koha-fr.org
Wed Aug 1 11:20:03 CEST 2007


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	paul poulain <tipaul>	07/08/01 09:20:03

Modified files:
	misc/migration_tools: rebuild_zebra.pl 

Log message:
	eval() on getAuthority & getBiblio to avoid a script failure

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/misc/migration_tools/rebuild_zebra.pl?cvsroot=koha&r1=1.11&r2=1.12

Patches:
Index: rebuild_zebra.pl
===================================================================
RCS file: /sources/koha/koha/misc/migration_tools/rebuild_zebra.pl,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- rebuild_zebra.pl	6 Jun 2007 13:08:36 -0000	1.11
+++ rebuild_zebra.pl	1 Aug 2007 09:20:03 -0000	1.12
@@ -290,7 +290,15 @@
         $sth->execute();
         my $i=0;
         while (my ($authid) = $sth->fetchrow) {
-            my $record = GetAuthority($authid);
+            my $record;
+            eval {
+                $record = GetAuthority($authid);
+            };
+            if($@){
+                print "  There was some pb getting authority : ".$authid."\n";
+            next;
+            }
+
             print ".";
             print "\r$i" unless ($i++ %100);
             # remove leader length, that could be wrong, it will be calculated automatically by as_usmarc
@@ -481,11 +489,18 @@
         open(OUT,">:utf8 ","$directory/biblios/export") or die $!;
         my $dbh=C4::Context->dbh;
         my $sth;
-        $sth=$dbh->prepare("select biblionumber from biblioitems where biblionumber >54000 order by biblionumber $limit");
+        $sth=$dbh->prepare("select biblionumber from biblioitems order by biblionumber $limit");
         $sth->execute();
         my $i=0;
         while (my ($biblionumber) = $sth->fetchrow) {
-            my $record = GetMarcBiblio($biblionumber);
+            my $record;
+            eval {
+                $record = GetMarcBiblio($biblionumber);
+            };
+            if($@){
+                print "  There was some pb getting biblio : #".$biblionumber."\n";
+            next;
+            }
 #             warn $record->as_formatted;
 # die if $record->subfield('090','9') eq 11;
     #         print $record;





More information about the Koha-cvs mailing list