View | Details | Raw Unified | Return to bug 27048
Collapse All | Expand All

(-)a/misc/migration_tools/rebuild_zebra.pl (-6 / +30 lines)
Lines 209-215 if( !defined $LockFH ) { Link Here
209
                    # the lockfile)
209
                    # the lockfile)
210
};
210
};
211
211
212
my $start_time = time();
212
if ( $verbose_logging ) {
213
if ( $verbose_logging ) {
214
    my $pretty_time = POSIX::strftime("%H:%M:%S",localtime($start_time));
213
    print "Zebra configuration information\n";
215
    print "Zebra configuration information\n";
214
    print "================================\n";
216
    print "================================\n";
215
    print "Zebra biblio directory      = $biblioserverdir\n";
217
    print "Zebra biblio directory      = $biblioserverdir\n";
Lines 219-224 if ( $verbose_logging ) { Link Here
219
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
221
    print "BIBLIONUMBER in :     $biblionumbertagfield\$$biblionumbertagsubfield\n";
220
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
222
    print "BIBLIOITEMNUMBER in : $biblioitemnumbertagfield\$$biblioitemnumbertagsubfield\n";
221
    print "================================\n";
223
    print "================================\n";
224
    print "Job started: $pretty_time\n";
222
}
225
}
223
226
224
my $tester = XML::LibXML->new();
227
my $tester = XML::LibXML->new();
Lines 267-272 if ($daemon_mode) { Link Here
267
270
268
271
269
if ( $verbose_logging ) {
272
if ( $verbose_logging ) {
273
    print "====================\n";
274
    print "Indexing complete: ". pretty_time() . "\n";
270
    print "====================\n";
275
    print "====================\n";
271
    print "CLEANING\n";
276
    print "CLEANING\n";
272
    print "====================\n";
277
    print "====================\n";
Lines 362-368 sub index_records { Link Here
362
    } else {
367
    } else {
363
        if ( $verbose_logging ) {
368
        if ( $verbose_logging ) {
364
            print "====================\n";
369
            print "====================\n";
365
            print "exporting $record_type\n";
370
            print "exporting $record_type " . pretty_time() . "\n";
366
            print "====================\n";
371
            print "====================\n";
367
        }
372
        }
368
        mkdir "$directory" unless (-d $directory);
373
        mkdir "$directory" unless (-d $directory);
Lines 403-409 sub index_records { Link Here
403
    } else {
408
    } else {
404
        if ( $verbose_logging ) {
409
        if ( $verbose_logging ) {
405
            print "====================\n";
410
            print "====================\n";
406
            print "REINDEXING zebra\n";
411
            print "REINDEXING zebra " . pretty_time() . "\n";
407
            print "====================\n";
412
            print "====================\n";
408
        }
413
        }
409
        my $record_fmt = 'marcxml';
414
        my $record_fmt = 'marcxml';
Lines 556-562 sub export_marc_records_from_sth { Link Here
556
            }
561
            }
557
        }
562
        }
558
    }
563
    }
559
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
564
    print "\nRecords exported: $num_exported " . pretty_time() . "\n" if ( $verbose_logging );
560
    print {$fh} $marcxml_close;
565
    print {$fh} $marcxml_close;
561
566
562
    close $fh;
567
    close $fh;
Lines 593-599 sub export_marc_records_from_list { Link Here
593
            }
598
            }
594
        }
599
        }
595
    }
600
    }
596
    print "\nRecords exported: $num_exported\n" if ( $verbose_logging );
601
    print "\nRecords exported: $num_exported " . pretty_time() . "\n" if ( $verbose_logging );
597
602
598
    print {$fh} $marcxml_close;
603
    print {$fh} $marcxml_close;
599
604
Lines 632-638 sub generate_deleted_marc_records { Link Here
632
637
633
        $records_deleted->{$record_number} = 1;
638
        $records_deleted->{$record_number} = 1;
634
    }
639
    }
635
    print "\nRecords exported: $i\n" if ( $verbose_logging );
640
    print "\nRecords exported: $i " . pretty_time() . "\n" if ( $verbose_logging );
636
641
637
    print {$fh} $marcxml_close;
642
    print {$fh} $marcxml_close;
638
643
Lines 826-831 sub _create_lockfile { #returns undef on failure Link Here
826
    return ( $fh, $dir.'/'.LOCK_FILENAME );
831
    return ( $fh, $dir.'/'.LOCK_FILENAME );
827
}
832
}
828
833
834
sub pretty_time {
835
    use integer;
836
    my $now = time;
837
    my $elapsed = $now - $start_time;
838
    local $_ = $elapsed;
839
    my ( $d, $h, $m, $s );
840
    $s = $_ % 60;
841
    $_ /= 60;
842
    $m = $_ % 60;
843
    $_ /= 60;
844
    $h = $_ % 24;
845
    $_ /= 24;
846
    $d = $_;
847
848
    my $now_pretty = POSIX::strftime("%H:%M:%S",localtime($now));
849
    my $elapsed_pretty = $d ? "[$d:$h:$m:$s]" : $h ? "[$h:$m:$s]" : $m ? "[$m:$s]" : "[$s]";
850
851
    return "$now_pretty $elapsed_pretty";
852
}
853
829
sub print_usage {
854
sub print_usage {
830
    print <<_USAGE_;
855
    print <<_USAGE_;
831
$0: reindex MARC bibs and/or authorities in Zebra.
856
$0: reindex MARC bibs and/or authorities in Zebra.
832
- 

Return to bug 27048