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

(-)a/misc/migration_tools/rebuild_zebra.pl (-16 / +12 lines)
Lines 34-40 my $as_xml; Link Here
34
my $process_zebraqueue;
34
my $process_zebraqueue;
35
my $do_not_clear_zebraqueue;
35
my $do_not_clear_zebraqueue;
36
my $verbose_logging;
36
my $verbose_logging;
37
my $zebraidx_log_opt = " -v none,fatal,warn ";
37
my $zebraidx_log_opt = " -v none,fatal ";
38
my $result = GetOptions(
38
my $result = GetOptions(
39
    'd:s'           => \$directory,
39
    'd:s'           => \$directory,
40
    'reset'         => \$reset,
40
    'reset'         => \$reset,
Lines 65-76 if (not $biblios and not $authorities) { Link Here
65
    die $msg;
65
    die $msg;
66
}
66
}
67
67
68
if ($authorities and $as_xml) {
69
    my $msg = "Cannot specify both -a and -x\n";
70
    $msg   .= "Please do '$0 --help' to see usage.\n";
71
    die $msg;
72
}
73
74
if ( !$as_xml and $nosanitize ) {
68
if ( !$as_xml and $nosanitize ) {
75
    my $msg = "Cannot specify both -no_xml and -nosanitize\n";
69
    my $msg = "Cannot specify both -no_xml and -nosanitize\n";
76
    $msg   .= "Please do '$0 --help' to see usage.\n";
70
    $msg   .= "Please do '$0 --help' to see usage.\n";
Lines 237-246 sub index_records { Link Here
237
    }
231
    }
238
	my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
232
	my $record_fmt = ($as_xml) ? 'marcxml' : 'iso2709' ;
239
    if ($process_zebraqueue) {
233
    if ($process_zebraqueue) {
240
        do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) 
241
            if $num_records_deleted;
242
        do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
234
        do_indexing($record_type, 'update', "$directory/upd_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
243
            if $num_records_exported;
235
            if $num_records_exported;
236
        do_indexing($record_type, 'delete', "$directory/del_$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt) 
237
            if $num_records_deleted;
244
    } else {
238
    } else {
245
        do_indexing($record_type, 'update', "$directory/$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
239
        do_indexing($record_type, 'update', "$directory/$record_type", $reset, $noshadow, $record_fmt, $zebraidx_log_opt)
246
            if ($num_records_exported or $skip_export);
240
            if ($num_records_exported or $skip_export);
Lines 424-430 sub get_raw_marc_record { Link Here
424
    my $marc; 
418
    my $marc; 
425
    if ($record_type eq 'biblio') {
419
    if ($record_type eq 'biblio') {
426
        if ($noxml) {
420
        if ($noxml) {
427
            my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ?");
421
            my $fetch_sth = $dbh->prepare_cached("SELECT marc FROM biblioitems WHERE biblionumber = ?
422
                                                  UNION SELECT marc from deletedbiblioitems where biblionumber=?");
428
            $fetch_sth->execute($record_number);
423
            $fetch_sth->execute($record_number);
429
            if (my ($blob) = $fetch_sth->fetchrow_array) {
424
            if (my ($blob) = $fetch_sth->fetchrow_array) {
430
                $marc = MARC::Record->new_from_usmarc($blob);
425
                $marc = MARC::Record->new_from_usmarc($blob);
Lines 435-441 sub get_raw_marc_record { Link Here
435
                        # trying to process a record update
430
                        # trying to process a record update
436
            }
431
            }
437
        } else {
432
        } else {
438
            eval { $marc = GetMarcBiblio($record_number); };
433
            eval { $marc = GetMarcBiblio($record_number,"include_deleted_table"); };
439
            if ($@) {
434
            if ($@) {
440
                # here we do warn since catching an exception
435
                # here we do warn since catching an exception
441
                # means that the bib was found but failed
436
                # means that the bib was found but failed
Lines 451-457 sub get_raw_marc_record { Link Here
451
            return;
446
            return;
452
        }
447
        }
453
    }
448
    }
454
    return $marc;
449
        return $marc;
455
}
450
}
456
451
457
sub fix_leader {
452
sub fix_leader {
Lines 479-488 sub fix_biblio_ids { Link Here
479
    my $biblioitemnumber;
474
    my $biblioitemnumber;
480
    if (@_) {
475
    if (@_) {
481
        $biblioitemnumber = shift;
476
        $biblioitemnumber = shift;
482
    } else {    
477
    } else {
483
        my $sth = $dbh->prepare(
478
        my $sth = $dbh->prepare(
484
            "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?");
479
            "SELECT biblioitemnumber FROM biblioitems WHERE biblionumber=?
485
        $sth->execute($biblionumber);
480
             UNION SELECT biblioitemnumber FROM deletedbiblioitems WHERE biblionumber=?");
481
        $sth->execute($biblionumber,$biblionumber);
486
        ($biblioitemnumber) = $sth->fetchrow_array;
482
        ($biblioitemnumber) = $sth->fetchrow_array;
487
        $sth->finish;
483
        $sth->finish;
488
        unless ($biblioitemnumber) {
484
        unless ($biblioitemnumber) {
Lines 515-520 sub fix_authority_id { Link Here
515
    }
511
    }
516
}
512
}
517
513
514
518
sub fix_unimarc_100 {
515
sub fix_unimarc_100 {
519
    # FIXME - again, if this is necessary, it belongs in C4::AuthoritiesMarc.
516
    # FIXME - again, if this is necessary, it belongs in C4::AuthoritiesMarc.
520
    my $marc = shift;
517
    my $marc = shift;
521
- 

Return to bug 5724