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

(-)a/about.pl (-6 / +25 lines)
Lines 41-48 use C4::Installer::PerlModules; Link Here
41
use Koha;
41
use Koha;
42
use Koha::DateUtils qw( dt_from_string output_pref );
42
use Koha::DateUtils qw( dt_from_string output_pref );
43
use Koha::Acquisition::Currencies;
43
use Koha::Acquisition::Currencies;
44
use Koha::Authorities;
44
use Koha::BackgroundJob;
45
use Koha::BackgroundJob;
45
use Koha::BiblioFrameworks;
46
use Koha::BiblioFrameworks;
47
use Koha::Biblios;
46
use Koha::Email;
48
use Koha::Email;
47
use Koha::Patron::Categories;
49
use Koha::Patron::Categories;
48
use Koha::Patrons;
50
use Koha::Patrons;
Lines 354-359 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { Link Here
354
    my $es_status;
356
    my $es_status;
355
    my $es_config_error;
357
    my $es_config_error;
356
    my $es_running = 1;
358
    my $es_running = 1;
359
    my $es_has_missing = 0;
357
360
358
    my $es_conf;
361
    my $es_conf;
359
    try {
362
    try {
Lines 378-392 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { Link Here
378
        my $es_status->{version} = $es->info->{version}->{number};
381
        my $es_status->{version} = $es->info->{version}->{number};
379
382
380
        foreach my $index ( @indexes ) {
383
        foreach my $index ( @indexes ) {
381
            my $count;
384
            my $index_count;
382
            try {
385
            try {
383
                $count = $es->indices->stats( index => $index )
386
                $index_count = $es->indices->stats( index => $index )
384
                      ->{_all}{primaries}{docs}{count};
387
                      ->{_all}{primaries}{docs}{count};
385
            }
388
            }
386
            catch {
389
            catch {
387
                if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
390
                if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
388
                    push @{ $es_status->{errors} }, "Index not found ($index)";
391
                    push @{ $es_status->{errors} }, "Index not found ($index)";
389
                    $count = -1;
392
                    $index_count = -1;
390
                }
393
                }
391
                elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
394
                elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
392
                    $es_running = 0;
395
                    $es_running = 0;
Lines 397-411 if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) { Link Here
397
                }
400
                }
398
            };
401
            };
399
402
403
            my $db_count = -1;
404
            my $missing_count = 0;
405
            if ( $index eq $biblios_index_name ) {
406
                $db_count = Koha::Biblios->search->count;
407
            } elsif ( $index eq $authorities_index_name ) {
408
                $db_count = Koha::Authorities->search->count;
409
            }
410
            if ( $db_count != -1 && $index_count != -1 ) {
411
                $missing_count = $db_count - $index_count;
412
                $es_has_missing = 1 if $missing_count > 0;
413
            }
400
            push @{ $es_status->{indexes} },
414
            push @{ $es_status->{indexes} },
401
              {
415
              {
402
                index_name => $index,
416
                index_name    => $index,
403
                count      => $count
417
                index_count   => $index_count,
418
                db_count      => $db_count,
419
                missing_count => $missing_count,
404
              };
420
              };
405
        }
421
        }
406
        $es_status->{running} = $es_running;
422
        $es_status->{running} = $es_running;
407
423
408
        $template->param( elasticsearch_status => $es_status );
424
        $template->param(
425
            elasticsearch_status      => $es_status,
426
            elasticsearch_has_missing => $es_has_missing,
427
        );
409
    }
428
    }
410
}
429
}
411
430
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (-3 / +18 lines)
Lines 80-86 Link Here
80
                    |
80
                    |
81
                    Indices:
81
                    Indices:
82
                  [% FOREACH index IN elasticsearch_status.indexes %]
82
                  [% FOREACH index IN elasticsearch_status.indexes %]
83
                      [% index.index_name | html %] (count: <emph>[% index.count | html %]</emph>)[% UNLESS loop.last %], [% END %]
83
                      [% index.index_name | html %] (count: <emph>[% index.index_count | html %]</emph>)[% UNLESS loop.last %], [% END %]
84
                  [% END %]
84
                  [% END %]
85
                [% ELSE %]
85
                [% ELSE %]
86
                    <span class="bg-warning">not running</span>
86
                    <span class="bg-warning">not running</span>
Lines 216-222 Link Here
216
        </div>
216
        </div>
217
217
218
        <div role="tabpanel" class="tab-pane" id="sysinfo">
218
        <div role="tabpanel" class="tab-pane" id="sysinfo">
219
    [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker %]
219
    [% IF warnPrefBiblioAddsAuthorities || warnPrefEasyAnalyticalRecords || warnPrefAnonymousPatronOPACPrivacy || warnPrefAnonymousPatronAnonSuggestions || warnPrefAnonymousPatronOPACPrivacy_PatronDoesNotExist || warnPrefAnonymousPatronAnonSuggestions_PatronDoesNotExist || warnPrefKohaAdminEmailAddress || warnPrefOpacHiddenItems || invalid_yesno.count || warnNoActiveCurrency || warnIsRootUser || xml_config_warnings.size || AutoSelfCheckPatronDoesNotHaveSelfCheckPerm || AutoSelfCheckPatronHasTooManyPerm || warnStatisticsFieldsError || warnNoTemplateCaching || warnILLConfiguration || has_ai_issues || oauth2_missing_deps || bad_yaml_prefs || warnRelationships || log4perl_errors || config_bcrypt_settings_no_set || warnHiddenBiblionumbers.size || warnConnectBroker || elasticsearch_has_missing %]
220
        [% IF (warnIsRootUser) %]
220
        [% IF (warnIsRootUser) %]
221
            <h2>Warning regarding current user</h2>
221
            <h2>Warning regarding current user</h2>
222
            <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p>
222
            <p>You are logged in as the database administrative user. This is not recommended because some parts of Koha will not function as expected when using this account.</p>
Lines 511-516 Link Here
511
            </table>
511
            </table>
512
        [% END %]
512
        [% END %]
513
513
514
        [% IF elasticsearch_has_missing %]
515
            <table>
516
                <caption>Records are missing in Elasticsearch search engine</caption>
517
                [% FOREACH index IN elasticsearch_status.indexes %]
518
                    [% IF index.missing_count %]
519
                    <tr>
520
                        <th scope="row"><strong>Warning</strong></th>
521
                        <td>
522
                            [% index.missing_count | html %] record(s) missing on a total of [% index.index_count | html %] in indice [% index.index_name | html %].
523
                        </td>
524
                    </tr>
525
                    [% END %]
526
                [% END %]
527
            </table>
528
        [% END %]
529
514
    [% ELSE %]
530
    [% ELSE %]
515
        <p>No warnings.</p>
531
        <p>No warnings.</p>
516
    [% END %]
532
    [% END %]
517
- 

Return to bug 27667