|
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 |
|