Merge branch 'MDL-53247_fix' of git://github.com/dmonllao/moodle
authorAndrew Nicols <andrew@nicols.co.uk>
Wed, 9 Mar 2016 06:05:00 +0000 (14:05 +0800)
committerAndrew Nicols <andrew@nicols.co.uk>
Wed, 9 Mar 2016 06:05:00 +0000 (14:05 +0800)
search/cli/indexer.php

index b40a20b..f42b8e9 100644 (file)
@@ -56,6 +56,17 @@ if (!\core_search\manager::is_global_search_enabled() && empty($options['force']
     cli_error('Global search is disabled. Use --force if you want to force an index while disabled');
 }
 
+if (!$searchengine = \core_search\manager::search_engine_instance()) {
+    cli_error(get_string('engineserverstatus', 'search'));
+}
+if (!$searchengine->is_installed()) {
+    cli_error('enginenotinstalled', 'search', $CFG->searchengine);
+}
+$serverstatus = $searchengine->is_server_ready();
+if ($serverstatus !== true) {
+    cli_error($serverstatus);
+}
+
 $globalsearch = \core_search\manager::instance();
 
 if (empty($options['reindex'])) {