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

(-)a/about.pl (+66 lines)
Lines 27-32 use List::MoreUtils qw/ any /; Link Here
27
use LWP::Simple;
27
use LWP::Simple;
28
use XML::Simple;
28
use XML::Simple;
29
use Config;
29
use Config;
30
use Search::Elasticsearch;
31
use Try::Tiny;
30
32
31
use C4::Output;
33
use C4::Output;
32
use C4::Auth;
34
use C4::Auth;
Lines 40-47 use Koha::Patrons; Link Here
40
use Koha::Caches;
42
use Koha::Caches;
41
use Koha::Config::SysPrefs;
43
use Koha::Config::SysPrefs;
42
use Koha::Illrequest::Config;
44
use Koha::Illrequest::Config;
45
use Koha::SearchEngine::Elasticsearch;
46
43
use C4::Members::Statistics;
47
use C4::Members::Statistics;
44
48
49
45
#use Smart::Comments '####';
50
#use Smart::Comments '####';
46
51
47
my $query = new CGI;
52
my $query = new CGI;
Lines 292-297 if ( C4::Context->preference('ILLModule') ) { Link Here
292
    $template->param( warnILLConfiguration => $warnILLConfiguration );
297
    $template->param( warnILLConfiguration => $warnILLConfiguration );
293
}
298
}
294
299
300
if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
301
    # Check ES configuration health and runtime status
302
303
    my $es_status;
304
    my $es_config_error;
305
    my $es_running = 1;
306
307
    my $es_conf;
308
    try {
309
        $es_conf = Koha::SearchEngine::Elasticsearch::_read_configuration();
310
    }
311
    catch {
312
        if ( ref($_) eq 'Koha::Exceptions::Config::MissingEntry' ) {
313
            $template->param( elasticsearch_fatal_config_error => $_->message );
314
            $es_config_error = 1;
315
        }
316
        warn p($_);
317
    };
318
    if ( !$es_config_error ) {
319
320
        my $biblios_index_name     = $es_conf->{index_name} . "_" . $Koha::SearchEngine::BIBLIOS_INDEX;
321
        my $authorities_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::AUTHORITIES_INDEX;
322
323
        my @indexes = ($biblios_index_name, $authorities_index_name);
324
        # TODO: When new indexes get added, we could have other ways to
325
        #       fetch the list of available indexes (e.g. plugins, etc)
326
        $es_status->{nodes} = $es_conf->{nodes};
327
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
328
329
        foreach my $index ( @indexes ) {
330
            my $count;
331
            try {
332
                $count = $es->indices->stats( index => $index )
333
                      ->{_all}{primaries}{docs}{count};
334
            }
335
            catch {
336
                if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
337
                    push @{ $es_status->{errors} }, "Index not found ($index)";
338
                    $count = -1;
339
                }
340
                elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
341
                    $es_running = 0;
342
                }
343
                else {
344
                    # TODO: when time comes, we will cover more use cases
345
                    die $_;
346
                }
347
            };
348
349
            push @{ $es_status->{indexes} },
350
              {
351
                index_name => $index,
352
                count      => $count
353
              };
354
        }
355
        $es_status->{running} = $es_running;
356
357
        $template->param( elasticsearch_status => $es_status );
358
    }
359
}
360
295
# Sco Patron should not contain any other perms than circulate => self_checkout
361
# Sco Patron should not contain any other perms than circulate => self_checkout
296
if (  C4::Context->preference('WebBasedSelfCheck')
362
if (  C4::Context->preference('WebBasedSelfCheck')
297
      and C4::Context->preference('AutoSelfCheckAllowed')
363
      and C4::Context->preference('AutoSelfCheckAllowed')
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt (-1 / +26 lines)
Lines 1-4 Link Here
1
[% USE HtmlTags %]
1
[% USE HtmlTags %]
2
[% USE Koha %]
2
[% SET footerjs = 1 %]
3
[% SET footerjs = 1 %]
3
[% INCLUDE 'doc-head-open.inc' %]
4
[% INCLUDE 'doc-head-open.inc' %]
4
<title>Koha &rsaquo; About Koha</title>
5
<title>Koha &rsaquo; About Koha</title>
Lines 45-50 Link Here
45
          [% IF (is_psgi) %]
46
          [% IF (is_psgi) %]
46
            <tr><th scope="row">PSGI: </th><td>[% psgi_server |html %]</td></tr>
47
            <tr><th scope="row">PSGI: </th><td>[% psgi_server |html %]</td></tr>
47
          [% END %]
48
          [% END %]
49
          [% IF Koha.Preference('SearchEngine') == 'Elasticsearch' %]
50
            <tr>
51
                <th scope="row">Elasticsearch: </th>
52
            [% IF elasticsearch_fatal_config_error %]
53
                <td><span class="status_warn">[% elasticsearch_fatal_config_error %]</span></td>
54
            [% ELSE %]
55
                <td>
56
                    Nodes:
57
                    <span>[% elasticsearch_status.nodes.join(' / ') %]</span>
58
                    |
59
                    Status:
60
                [% IF elasticsearch_status.running %]
61
                    <span class="status_ok">running</span>
62
                    |
63
                    Indices:
64
                  [% FOREACH index IN elasticsearch_status.indexes %]
65
                      [% index.index_name %] (count: <emph>[% index.count %]</emph>)
66
                  [% END %]
67
                [% ELSE %]
68
                    <span class="status_warn">not running</span>
69
                [% END %]
70
                </td>
71
            [% END %]
72
            </tr>
73
          [% END %]
48
            <tr><th scope="row">Memcached: </th>
74
            <tr><th scope="row">Memcached: </th>
49
                <td>
75
                <td>
50
                    Servers: [% IF memcached_servers %]<span>[% memcached_servers | html %]</span>
76
                    Servers: [% IF memcached_servers %]<span>[% memcached_servers | html %]</span>
51
- 

Return to bug 19542