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 38-45 use Koha::Acquisition::Currencies; Link Here
38
use Koha::Patrons;
40
use Koha::Patrons;
39
use Koha::Caches;
41
use Koha::Caches;
40
use Koha::Config::SysPrefs;
42
use Koha::Config::SysPrefs;
43
use Koha::SearchEngine::Elasticsearch;
44
41
use C4::Members::Statistics;
45
use C4::Members::Statistics;
42
46
47
43
#use Smart::Comments '####';
48
#use Smart::Comments '####';
44
49
45
my $query = new CGI;
50
my $query = new CGI;
Lines 260-265 if ( !defined C4::Context->config('use_zebra_facets') ) { Link Here
260
    }
265
    }
261
}
266
}
262
267
268
if ( C4::Context->preference('SearchEngine') eq 'Elasticsearch' ) {
269
    # Check ES configuration health and runtime status
270
271
    my $es_status;
272
    my $es_config_error;
273
    my $es_running = 1;
274
275
    my $es_conf;
276
    try {
277
        $es_conf = Koha::SearchEngine::Elasticsearch::_read_configuration();
278
    }
279
    catch {
280
        if ( ref($_) eq 'Koha::Exceptions::Config::MissingEntry' ) {
281
            $template->param( elasticsearch_fatal_config_error => $_->message );
282
            $es_config_error = 1;
283
        }
284
        warn p($_);
285
    };
286
    if ( !$es_config_error ) {
287
288
        my $biblios_index_name     = $es_conf->{index_name} . "_" . $Koha::SearchEngine::BIBLIOS_INDEX;
289
        my $authorities_index_name = $es_conf->{index_name} . "_" . $Koha::SearchEngine::AUTHORITIES_INDEX;
290
291
        my @indexes = ($biblios_index_name, $authorities_index_name);
292
        # TODO: When new indexes get added, we could have other ways to
293
        #       fetch the list of available indexes (e.g. plugins, etc)
294
        $es_status->{nodes} = $es_conf->{nodes};
295
        my $es = Search::Elasticsearch->new({ nodes => $es_conf->{nodes} });
296
297
        foreach my $index ( @indexes ) {
298
            my $count;
299
            try {
300
                $count = $es->indices->stats( index => $index )
301
                      ->{_all}{primaries}{docs}{count};
302
            }
303
            catch {
304
                if ( ref($_) eq 'Search::Elasticsearch::Error::Missing' ) {
305
                    push @{ $es_status->{errors} }, "Index not found ($index)";
306
                    $count = -1;
307
                }
308
                elsif ( ref($_) eq 'Search::Elasticsearch::Error::NoNodes' ) {
309
                    $es_running = 0;
310
                }
311
                else {
312
                    # TODO: when time comes, we will cover more use cases
313
                    die $_;
314
                }
315
            };
316
317
            push @{ $es_status->{indexes} },
318
              {
319
                index_name => $index,
320
                count      => $count
321
              };
322
        }
323
        $es_status->{running} = $es_running;
324
325
        $template->param( elasticsearch_status => $es_status );
326
    }
327
}
328
263
# Sco Patron should not contain any other perms than circulate => self_checkout
329
# Sco Patron should not contain any other perms than circulate => self_checkout
264
if (  C4::Context->preference('WebBasedSelfCheck')
330
if (  C4::Context->preference('WebBasedSelfCheck')
265
      and C4::Context->preference('AutoSelfCheckAllowed')
331
      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