[Koha-cvs] CVS: koha/misc rebuildthesaurus.pl,1.1.2.2,1.1.2.3

Paul POULAIN tipaul at users.sourceforge.net
Tue Feb 10 14:20:37 CET 2004


Update of /cvsroot/koha/koha/misc
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11252/misc

Modified Files:
      Tag: rel_2_0
	rebuildthesaurus.pl 
Log Message:
changes in rebuildthesaurus calls.

Index: rebuildthesaurus.pl
===================================================================
RCS file: /cvsroot/koha/koha/misc/Attic/rebuildthesaurus.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -C2 -r1.1.2.2 -r1.1.2.3
*** rebuildthesaurus.pl	26 Jan 2004 10:40:31 -0000	1.1.2.2
--- rebuildthesaurus.pl	10 Feb 2004 13:20:30 -0000	1.1.2.3
***************
*** 45,49 ****
  
  my $dbh = C4::Context->dbh;
! my @subfields = $subfields =~ /(\S)/g;
  if ($delete) {
  	print "deleting thesaurus\n";
--- 45,49 ----
  
  my $dbh = C4::Context->dbh;
! my @subf = $subfields =~ /(##\d\d\d##.)/g;
  if ($delete) {
  	print "deleting thesaurus\n";
***************
*** 54,64 ****
  	print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
  }
  
  my $starttime = gettimeofday;
  my $sth = $dbh->prepare("select bibid from marc_biblio");
  $sth->execute;
! my $i;
  while (my ($bibid) = $sth->fetchrow) {
  	my $record = MARCgetbiblio($dbh,$bibid);
  #	warn $record->as_formatted;
  	my $resultstring = $subfields;
--- 54,69 ----
  	print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
  }
+ $|=1; # flushes output
  
  my $starttime = gettimeofday;
  my $sth = $dbh->prepare("select bibid from marc_biblio");
  $sth->execute;
! my $i=1;
  while (my ($bibid) = $sth->fetchrow) {
  	my $record = MARCgetbiblio($dbh,$bibid);
+ 	print ".";
+ 	my $timeneeded = gettimeofday - $starttime;
+ 	print "$i in $timeneeded s\n" unless ($i % 50);
+ 
  #	warn $record->as_formatted;
  	my $resultstring = $subfields;
***************
*** 70,83 ****
  			$resultstring =~ s/##$fieldvalue##$pair->[0]/$pair->[1]/g;
  		}
  		# deals empty subfields
! 		foreach my $empty (@subfields) {
! 			$resultstring =~ s/\$$empty//g;
  		}
- 		warn "RRR $resultstring";
- 		if ($resultstring ne $subfields && $resultstring &&
- 		&newauthority($dbh,$category,$resultstring);
  		$i++;
- 	}
  }
  my $timeneeded = gettimeofday - $starttime;
! print "$i entries done in $timeneeded seconds\n";
--- 75,88 ----
  			$resultstring =~ s/##$fieldvalue##$pair->[0]/$pair->[1]/g;
  		}
+ 	}
  		# deals empty subfields
! 		foreach my $empty (@subf) {
! 			$resultstring =~ s/$empty//g;
! 		}
! 		if ($resultstring ne $subfields && $resultstring) {
! 			&newauthority($dbh,$category,$resultstring);
  		}
  		$i++;
  }
  my $timeneeded = gettimeofday - $starttime;
! print "$i entries done in $timeneeded seconds (".($i/$timeneeded)." per second)\n";





More information about the Koha-cvs mailing list