From 721d74b02cbafd437f338561a6439849c7faf263 Mon Sep 17 00:00:00 2001 From: skodak Date: Mon, 30 Oct 2006 21:01:47 +0000 Subject: [PATCH] Disabled global search by default and marked as experimental MDL-7296 and AJAX moved to experimental too; merged from MOODLE_17_STABLE --- admin/settings/misc.php | 10 +++++++++- admin/settings/server.php | 1 - blocks/search/block_search.php | 6 +++++- lang/en_utf8/admin.php | 4 ++++ search/add.php | 4 ++++ search/cron.php | 4 ++++ search/delete.php | 4 ++++ search/indexer.php | 4 ++++ search/indexersplash.php | 4 ++++ search/query.php | 8 ++++++++ search/stats.php | 8 ++++++++ search/tests/index.php | 4 ++++ search/update.php | 4 ++++ 13 files changed, 62 insertions(+), 3 deletions(-) diff --git a/admin/settings/misc.php b/admin/settings/misc.php index 57f3b39851..f14c8e552a 100644 --- a/admin/settings/misc.php +++ b/admin/settings/misc.php @@ -1,9 +1,17 @@ add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0)); +$temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0)); +$ADMIN->add('misc', $temp); + +// XMLDB editor $ADMIN->add('misc', new admin_externalpage('xmldbeditor', get_string('xmldbeditor'), "$CFG->wwwroot/$CFG->admin/xmldb/")); + // hidden scripts linked from elsewhere $ADMIN->add('misc', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true)); $ADMIN->add('misc', new admin_externalpage('upgradeforumread', 'Upgrade forum', $CFG->wwwroot.'/'.$CFG->admin.'/upgradeforumread.php', 'moodle/site:config', true)); diff --git a/admin/settings/server.php b/admin/settings/server.php index 9a62bc5fa4..b01eabaa95 100644 --- a/admin/settings/server.php +++ b/admin/settings/server.php @@ -88,7 +88,6 @@ $ADMIN->add('server', $temp); $temp = new admin_settingpage('debugging', get_string('debugging', 'admin')); $temp->add(new admin_setting_special_debug()); $temp->add(new admin_setting_special_perfdebug()); -$temp->add(new admin_setting_configcheckbox('enableajax', get_string('enableajax', 'admin'), get_string('configenableajax', 'admin'), 0)); $ADMIN->add('server', $temp); diff --git a/blocks/search/block_search.php b/blocks/search/block_search.php index 778dc6bf39..96b73ec2d7 100644 --- a/blocks/search/block_search.php +++ b/blocks/search/block_search.php @@ -30,7 +30,11 @@ function get_content() { global $CFG; - + + if (empty($CFG->enableglobalsearch)) { + return ''; + } + //cache block contents if ($this->content !== NULL) { return $this->content; diff --git a/lang/en_utf8/admin.php b/lang/en_utf8/admin.php index 5ce5497b52..d906d50cdb 100644 --- a/lang/en_utf8/admin.php +++ b/lang/en_utf8/admin.php @@ -3,6 +3,10 @@ // begin {added with admin cleanup} +$string['experimental'] = 'Experimental'; +$string['enableglobalsearch'] = 'Enable global search'; +$string['configenableglobalsearch'] = 'This setting enables global text searching in resources and activities, it is not compatible with PHP 4.'; +$string['enableajax'] = 'Enable AJAX'; $string['gradebook'] = 'Gradebook'; $string['gradebookroles'] = 'Graded roles'; $string['configgradebookroles'] = 'This setting allows you to control who appears on the gradebook. Users need to have at least one of these roles in a course to be shown in the gradebook for that course.'; diff --git a/search/add.php b/search/add.php index f6f2607e0c..285c9d948c 100644 --- a/search/add.php +++ b/search/add.php @@ -5,6 +5,10 @@ require_login(); + if (empty($CFG->enableglobalsearch)) { + error('Global searching is not enabled.'); + } + if (!isadmin()) { error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php"); } //if diff --git a/search/cron.php b/search/cron.php index 36797e3c14..841d51fe8c 100644 --- a/search/cron.php +++ b/search/cron.php @@ -15,6 +15,10 @@ require_once('../config.php'); require_once("$CFG->dirroot/search/lib.php"); + if (empty($CFG->enableglobalsearch)) { + error('Global searching is not enabled.'); + } + mtrace("
Starting cron...\n");
 
   mtrace("--DELETE----");
diff --git a/search/delete.php b/search/delete.php
index 2e0bc7991b..8b86305e12 100644
--- a/search/delete.php
+++ b/search/delete.php
@@ -5,6 +5,10 @@
 
   require_login();
 
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   if (!isadmin()) {
     error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
   } //if
diff --git a/search/indexer.php b/search/indexer.php
index 32300a58b3..04772c5cd0 100644
--- a/search/indexer.php
+++ b/search/indexer.php
@@ -25,6 +25,10 @@
   //only administrators can index the moodle installation, because access to all pages is required
   require_login();
 
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   if (!isadmin()) {
     error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
   } //if
diff --git a/search/indexersplash.php b/search/indexersplash.php
index a187fbd6ff..913e2ae669 100644
--- a/search/indexersplash.php
+++ b/search/indexersplash.php
@@ -9,6 +9,10 @@
 
   require_login();
 
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   if (!isadmin()) {
     error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
   } //if
diff --git a/search/query.php b/search/query.php
index fbefcfa755..6667201e90 100644
--- a/search/query.php
+++ b/search/query.php
@@ -25,6 +25,14 @@
   require_once('../config.php');
   require_once("$CFG->dirroot/search/lib.php");
 
+  if ($CFG->forcelogin) {
+    require_login();
+  }
+
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   $adv = new Object();
 
   //check for php5, but don't die yet (see line 52)
diff --git a/search/stats.php b/search/stats.php
index 948c8b0521..5e391b164f 100644
--- a/search/stats.php
+++ b/search/stats.php
@@ -7,6 +7,14 @@
   require_once('../config.php');
   require_once("$CFG->dirroot/search/lib.php");
 
+  if ($CFG->forcelogin) {
+    require_login();
+  }
+
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   //check for php5, but don't die yet
   if ($check = search_check_php5()) {
     require_once("$CFG->dirroot/search/indexlib.php");
diff --git a/search/tests/index.php b/search/tests/index.php
index 927f9d517b..b0a1609c6a 100644
--- a/search/tests/index.php
+++ b/search/tests/index.php
@@ -15,6 +15,10 @@
 
   require_login();
 
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   if (!isadmin()) {
     error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
   } //if
diff --git a/search/update.php b/search/update.php
index 0217afd3e4..8282a62bcd 100644
--- a/search/update.php
+++ b/search/update.php
@@ -5,6 +5,10 @@
 
   require_login();
 
+  if (empty($CFG->enableglobalsearch)) {
+    error('Global searching is not enabled.');
+  }
+
   if (!isadmin()) {
     error("You need to be an admin user to use this page.", "$CFG->wwwroot/login/index.php");
   } //if
-- 
2.39.5