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

(-)a/misc/migration_tools/rebuild_zebra.pl (-4 / +27 lines)
Lines 128-140 if ($do_munge) { Link Here
128
}
128
}
129
129
130
if ($authorities) {
130
if ($authorities) {
131
    index_records('authority', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt);
131
    index_records('authority', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $authorityserverdir);
132
} else {
132
} else {
133
    print "skipping authorities\n" if ( $verbose_logging );
133
    print "skipping authorities\n" if ( $verbose_logging );
134
}
134
}
135
135
136
if ($biblios) {
136
if ($biblios) {
137
    index_records('biblio', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt);
137
    index_records('biblio', $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $biblioserverdir);
138
} else {
138
} else {
139
    print "skipping biblios\n" if ( $verbose_logging );
139
    print "skipping biblios\n" if ( $verbose_logging );
140
}
140
}
Lines 166-176 if ($keep_export) { Link Here
166
    }
166
    }
167
}
167
}
168
168
169
# This checks to see if the zebra directories exist under the provided path.
170
# If they don't, then zebra is likely to spit the dummy. This returns true
171
# if the directories had to be created, false otherwise.
172
sub check_zebra_dirs {
173
	my ($base) = shift . '/';
174
	my $needed_repairing = 0;
175
	my @dirs = ( '', 'key', 'register', 'shadow' );
176
	foreach my $dir (@dirs) {
177
		my $bdir = $base . $dir;
178
        if (! -d $bdir) {
179
        	$needed_repairing = 1;
180
        	mkdir $bdir || die "Unable to create '$bdir': $!\n";
181
        	print "$0: needed to create '$bdir'\n";
182
        }
183
    }
184
    return $needed_repairing;
185
}	# ----------  end of subroutine check_zebra_dirs  ----------
186
169
sub index_records {
187
sub index_records {
170
    my ($record_type, $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt) = @_;
188
    my ($record_type, $directory, $skip_export, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_;
171
189
172
    my $num_records_exported = 0;
190
    my $num_records_exported = 0;
173
    my $num_records_deleted = 0;
191
    my $num_records_deleted = 0;
192
    my $need_reset = check_zebra_dirs($server_dir);
193
    if ($need_reset) {
194
    	print "$0: found broken zebra server directories: forcing a rebuild\n";
195
    	$reset = 1;
196
    }
174
    if ($skip_export && $verbose_logging) {
197
    if ($skip_export && $verbose_logging) {
175
        print "====================\n";
198
        print "====================\n";
176
        print "SKIPPING $record_type export\n";
199
        print "SKIPPING $record_type export\n";
Lines 222-227 sub index_records { Link Here
222
    }
245
    }
223
}
246
}
224
247
248
225
sub select_zebraqueue_records {
249
sub select_zebraqueue_records {
226
    my ($record_type, $update_type) = @_;
250
    my ($record_type, $update_type) = @_;
227
251
228
- 

Return to bug 5228