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

(-)a/misc/migration_tools/rebuild_zebra.pl (-12 / +22 lines)
Lines 36-41 my $noshadow; Link Here
36
my $want_help;
36
my $want_help;
37
my $as_xml;
37
my $as_xml;
38
my $process_zebraqueue;
38
my $process_zebraqueue;
39
my $process_zebraqueue_skip_deletes;
39
my $do_not_clear_zebraqueue;
40
my $do_not_clear_zebraqueue;
40
my $length;
41
my $length;
41
my $where;
42
my $where;
Lines 62-72 my $result = GetOptions( Link Here
62
    'x'             => \$as_xml,
63
    'x'             => \$as_xml,
63
    'y'             => \$do_not_clear_zebraqueue,
64
    'y'             => \$do_not_clear_zebraqueue,
64
    'z'             => \$process_zebraqueue,
65
    'z'             => \$process_zebraqueue,
65
    'where:s'        => \$where,
66
    'skip-deletes'  => \$process_zebraqueue_skip_deletes,
66
    'length:i'        => \$length,
67
    'where:s'       => \$where,
68
    'length:i'      => \$length,
67
    'offset:i'      => \$offset,
69
    'offset:i'      => \$offset,
68
    'v+'             => \$verbose_logging,
70
    'v+'            => \$verbose_logging,
69
    'run-as-root'    => \$run_as_root,
71
    'run-as-root'   => \$run_as_root,
70
);
72
);
71
73
72
if (not $result or $want_help) {
74
if (not $result or $want_help) {
Lines 258-264 sub index_records { Link Here
258
    my ($record_type, $directory, $skip_export, $skip_index, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_;
260
    my ($record_type, $directory, $skip_export, $skip_index, $process_zebraqueue, $as_xml, $noxml, $nosanitize, $do_not_clear_zebraqueue, $verbose_logging, $zebraidx_log_opt, $server_dir) = @_;
259
261
260
    my $num_records_exported = 0;
262
    my $num_records_exported = 0;
261
    my $records_deleted;
263
    my $records_deleted = {};
262
    my $need_reset = check_zebra_dirs($server_dir);
264
    my $need_reset = check_zebra_dirs($server_dir);
263
    if ($need_reset) {
265
    if ($need_reset) {
264
        print "$0: found broken zebra server directories: forcing a rebuild\n";
266
        print "$0: found broken zebra server directories: forcing a rebuild\n";
Lines 277-291 sub index_records { Link Here
277
        mkdir "$directory" unless (-d $directory);
279
        mkdir "$directory" unless (-d $directory);
278
        mkdir "$directory/$record_type" unless (-d "$directory/$record_type");
280
        mkdir "$directory/$record_type" unless (-d "$directory/$record_type");
279
        if ($process_zebraqueue) {
281
        if ($process_zebraqueue) {
280
            my $entries = select_zebraqueue_records($record_type, 'deleted');
282
            my $entries;
281
            mkdir "$directory/del_$record_type" unless (-d "$directory/del_$record_type");
283
282
            $records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml);
284
            unless ( $process_zebraqueue_skip_deletes ) {
283
            mark_zebraqueue_batch_done($entries);
285
                $entries = select_zebraqueue_records($record_type, 'deleted');
286
                mkdir "$directory/del_$record_type" unless (-d "$directory/del_$record_type");
287
                $records_deleted = generate_deleted_marc_records($record_type, $entries, "$directory/del_$record_type", $as_xml);
288
                mark_zebraqueue_batch_done($entries);
289
            }
290
284
            $entries = select_zebraqueue_records($record_type, 'updated');
291
            $entries = select_zebraqueue_records($record_type, 'updated');
285
            mkdir "$directory/upd_$record_type" unless (-d "$directory/upd_$record_type");
292
            mkdir "$directory/upd_$record_type" unless (-d "$directory/upd_$record_type");
286
            $num_records_exported = export_marc_records_from_list($record_type,
293
            $num_records_exported = export_marc_records_from_list($record_type,$entries, "$directory/upd_$record_type", $as_xml, $noxml, $records_deleted);
287
                                                                  $entries, "$directory/upd_$record_type", $as_xml, $noxml, $records_deleted);
288
            mark_zebraqueue_batch_done($entries);
294
            mark_zebraqueue_batch_done($entries);
295
289
        } else {
296
        } else {
290
            my $sth = select_all_records($record_type);
297
            my $sth = select_all_records($record_type);
291
            $num_records_exported = export_marc_records_from_sth($record_type, $sth, "$directory/$record_type", $as_xml, $noxml, $nosanitize);
298
            $num_records_exported = export_marc_records_from_sth($record_type, $sth, "$directory/$record_type", $as_xml, $noxml, $nosanitize);
Lines 759-764 Parameters: Link Here
759
                            table.  Cannot be used with -r
766
                            table.  Cannot be used with -r
760
                            or -s.
767
                            or -s.
761
768
769
    --skip-deletes          select only updated records marked
770
                            in the zebraqueue table, not deletes.
771
                            Only effective with -z.
772
762
    -r                      clear Zebra index before
773
    -r                      clear Zebra index before
763
                            adding records to index. Implies -w.
774
                            adding records to index. Implies -w.
764
775
765
- 

Return to bug 10955