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

(-)a/misc/migration_tools/rebuild_zebra.pl (-3 / +9 lines)
Lines 175-181 my $kohadir = C4::Context->config('intranetdir'); Link Here
175
my $bib_index_mode  = C4::Context->config('zebra_bib_index_mode')  // 'dom';
175
my $bib_index_mode  = C4::Context->config('zebra_bib_index_mode')  // 'dom';
176
my $auth_index_mode = C4::Context->config('zebra_auth_index_mode') // 'dom';
176
my $auth_index_mode = C4::Context->config('zebra_auth_index_mode') // 'dom';
177
177
178
my $dbh = C4::Context->dbh;
179
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
178
my ($biblionumbertagfield,$biblionumbertagsubfield) = &GetMarcFromKohaField("biblio.biblionumber","");
180
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
179
my ($biblioitemnumbertagfield,$biblioitemnumbertagsubfield) = &GetMarcFromKohaField("biblioitems.biblioitemnumber","");
181
180
Lines 227-232 if ( $verbose_logging ) { Link Here
227
}
226
}
228
227
229
my $tester = XML::LibXML->new();
228
my $tester = XML::LibXML->new();
229
my $dbh;
230
230
231
# The main work is done here by calling do_one_pass().  We have added locking
231
# The main work is done here by calling do_one_pass().  We have added locking
232
# avoid race conditions between full rebuilds and incremental updates either from
232
# avoid race conditions between full rebuilds and incremental updates either from
Lines 243-249 if ($daemon_mode) { Link Here
243
    while (1) {
243
    while (1) {
244
        # For incremental updates, skip the update if the updates are locked
244
        # For incremental updates, skip the update if the updates are locked
245
        if (_flock($LockFH, LOCK_EX|LOCK_NB)) {
245
        if (_flock($LockFH, LOCK_EX|LOCK_NB)) {
246
            do_one_pass() if ( zebraqueue_not_empty() );
246
            eval {
247
                $dbh = C4::Context->dbh;
248
                do_one_pass() if ( zebraqueue_not_empty() );
249
            };
250
            if ($@ && $verbose_logging) {
251
                warn "Warning : $@\n";
252
            }
247
            _flock($LockFH, LOCK_UN);
253
            _flock($LockFH, LOCK_UN);
248
        }
254
        }
249
        sleep $daemon_sleep;
255
        sleep $daemon_sleep;
Lines 252-257 if ($daemon_mode) { Link Here
252
    # all one-off invocations
258
    # all one-off invocations
253
    my $lock_mode = ($wait_for_lock) ? LOCK_EX : LOCK_EX|LOCK_NB;
259
    my $lock_mode = ($wait_for_lock) ? LOCK_EX : LOCK_EX|LOCK_NB;
254
    if (_flock($LockFH, $lock_mode)) {
260
    if (_flock($LockFH, $lock_mode)) {
261
        $dbh = C4::Context->dbh;
255
        do_one_pass();
262
        do_one_pass();
256
        _flock($LockFH, LOCK_UN);
263
        _flock($LockFH, LOCK_UN);
257
    } else {
264
    } else {
258
- 

Return to bug 17376