From 282ea1cdb4052f2de97a18a279cffc06ca3181ae Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Mon, 5 Oct 2015 17:44:14 +1300 Subject: [PATCH] Bug 12478: abort early if there's no elasticserch definition Signed-off-by: Nick Clemens Signed-off-by: Jesse Weaver Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- misc/search_tools/rebuild_elastic_search.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/misc/search_tools/rebuild_elastic_search.pl b/misc/search_tools/rebuild_elastic_search.pl index 8d19dd98da..af536f0df9 100755 --- a/misc/search_tools/rebuild_elastic_search.pl +++ b/misc/search_tools/rebuild_elastic_search.pl @@ -83,6 +83,7 @@ Full documentation. use autodie; use Getopt::Long; +use C4::Context; use Koha::Authority; use Koha::BiblioUtils; use Koha::ElasticSearch::Indexer; @@ -118,6 +119,8 @@ unless ($index_authorities || $index_biblios) { pod2usage(1) if $help; pod2usage( -exitstatus => 0, -verbose => 2 ) if $man; +sanity_check(); + my $next; if ($index_biblios) { _log(1, "Indexing biblios\n"); @@ -189,6 +192,13 @@ sub do_reindex { _log( 1, "$count records indexed.\n" ); } +# Checks some basic stuff to ensure that it's sane before we start. +sub sanity_check { + # Do we have an elasticsearch block defined? + my $conf = C4::Context->config('elasticsearch'); + die "No 'elasticsearch' block is defined in koha-conf.xml.\n" if ( !$conf ); +} + # Output progress information. # # _log($level, $msg); -- 2.39.5