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

(-)a/misc/migration_tools/remove_unused_authorities.pl (-7 / +19 lines)
Lines 49-59 if (@authtypes) { Link Here
49
    print "Restricted to authority type(s) : ".join(',', @authtypes).".\n";
49
    print "Restricted to authority type(s) : ".join(',', @authtypes).".\n";
50
}
50
}
51
51
52
my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
52
my $searcher = Koha::SearchEngine::Search->new( { index => 'biblios' } );
53
if ( $errZebraConnection == 10000 ) {
53
my $checksearch;
54
    die "Zebra server seems not to be available. This script needs Zebra runs.";
54
if ( C4::Context->preference("SearchEngine") eq 'Zebra' ) {
55
} elsif ( $errZebraConnection ) {
55
    # Check server state
56
    die "Error from Zebra: $errZebraConnection";
56
    my $errZebraConnection = C4::Context->Zconn("biblioserver",0)->errcode();
57
    if ( $errZebraConnection == 10000 ) {
58
        die "Zebra server seems not to be available. This script needs Zebra runs.";
59
    } elsif ( $errZebraConnection ) {
60
        die "Error from Zebra: $errZebraConnection";
61
    }
62
    $checksearch = q{an,alwaysmatches=''};
63
}
64
else {
65
    $checksearch = q{an:*};
66
}
67
# Check search on authority number as at least one result
68
my ($err,$res,$nb) = $searcher->simple_search_compat($checksearch,0,10);
69
unless ($nb > 0) {
70
    die "Searching authority number in biblio records seems not to be available : $checksearch";
57
}
71
}
58
72
59
my $dbh=C4::Context->dbh;
73
my $dbh=C4::Context->dbh;
Lines 68-74 $rqselect->execute(@authtypes); Link Here
68
my $counter=0;
82
my $counter=0;
69
my $totdeleted=0;
83
my $totdeleted=0;
70
my $totundeleted=0;
84
my $totundeleted=0;
71
my $searcher = Koha::SearchEngine::Search->new({index => 'biblios'});
72
while (my $data=$rqselect->fetchrow_hashref){
85
while (my $data=$rqselect->fetchrow_hashref){
73
    $counter++;
86
    $counter++;
74
    print 'authid='.$data->{'authid'};
87
    print 'authid='.$data->{'authid'};
75
- 

Return to bug 21865