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

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

Return to bug 21865