MDL-53247 search: allow search to be configured before enabled
authorDan Poltawski <dan@moodle.com>
Thu, 3 Mar 2016 04:28:52 +0000 (12:28 +0800)
committerDan Poltawski <dan@moodle.com>
Thu, 3 Mar 2016 04:31:21 +0000 (12:31 +0800)
The seach manager no longer checks if search is enabled before providing
an instance. It's up to the callers to do the access control.

report/search/index.php
search/classes/manager.php
search/engine/solr/setup_schema.php

index 5da3d20..64b435c 100644 (file)
@@ -37,8 +37,6 @@ echo $OUTPUT->heading($pagetitle);
 if (\core_search\manager::is_global_search_enabled() === false) {
     $renderer = $PAGE->get_renderer('core_search');
     echo $renderer->render_search_disabled();
-    echo $OUTPUT->footer();
-    exit;
 }
 
 $renderer = $PAGE->get_renderer('report_search');
index 3f8f7da..da68eb1 100644 (file)
@@ -99,10 +99,6 @@ class manager {
     /**
      * Returns an initialised \core_search instance.
      *
-     * It requires global search to be enabled. Use \core_search\manager::is_global_search_enabled
-     * to verify it is enabled.
-     *
-     * @throws \moodle_exception
      * @throws \core_search\engine_exception
      * @return \core_search\manager
      */
@@ -114,10 +110,6 @@ class manager {
             return static::$instance;
         }
 
-        if (!static::is_global_search_enabled()) {
-            throw new \moodle_exception('globalsearchdisabled', 'search');
-        }
-
         if (!$engine = static::search_engine_instance()) {
             throw new \core_search\engine_exception('enginenotfound', 'search', '', $CFG->searchengine);
         }
index 5ed2872..4ea17e2 100644 (file)
@@ -34,14 +34,6 @@ require_once($CFG->libdir.'/adminlib.php');
 require_login(null, false);
 require_capability('moodle/site:config', context_system::instance());
 
-if (!\core_search\manager::is_global_search_enabled()) {
-    throw new moodle_exception('globalsearchdisabled', 'search');
-}
-
-if ($CFG->searchengine !== 'solr') {
-    throw new moodle_exception('solrnotselected', 'search_solr');
-}
-
 $schema = new \search_solr\schema();
 $schema->setup();