# This patch file was generated by NetBeans IDE
# This patch can be applied using context Tools: Apply Diff Patch action on respective folder.
# It uses platform neutral UTF-8 encoding.
# Above lines and this line are ignored by the patching process.
Index: moodle/admin/settings/development.php
--- moodle/admin/settings/development.php Base (1.20)
+++ moodle/admin/settings/development.php Locally Modified (Based On 1.20)
@@ -8,7 +8,10 @@
     $ADMIN->add('development', new admin_category('experimental', get_string('experimental','admin')));
 
     $temp = new admin_settingpage('experimentalsettings', get_string('experimentalsettings', 'admin'));
-    $temp->add(new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0));
+    $englobalsearch = new admin_setting_configcheckbox('enableglobalsearch', get_string('enableglobalsearch', 'admin'), get_string('configenableglobalsearch', 'admin'), 0);
+    $englobalsearch->set_updatedcallback('search_updatedcallback');
+    $temp->add($englobalsearch);
+
     $temp->add(new admin_setting_configcheckbox('experimentalsplitrestore', get_string('experimentalsplitrestore', 'admin'), get_string('configexperimentalsplitrestore', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('enableimsccimport', get_string('enable_cc_import', 'imscc'), get_string('enable_cc_import_description', 'imscc'), 0));
     $temp->add(new admin_setting_configcheckbox('enablesafebrowserintegration', get_string('enablesafebrowserintegration', 'admin'), get_string('configenablesafebrowserintegration', 'admin'), 0));
Index: moodle/blocks/search/db/install.php
--- moodle/blocks/search/db/install.php No Base Revision
+++ moodle/blocks/search/db/install.php Locally New
@@ -0,0 +1,10 @@
+<?php
+
+function xmldb_block_search_install() {
+    global $DB;
+
+    // Disable this block by default as its experimental.
+    $DB->set_field('block', 'visible', 0, array('name'=>'search'));
+
+}
+
Index: moodle/blocks/search/db/upgrade.php
--- moodle/blocks/search/db/upgrade.php Base (1.15)
+++ moodle/blocks/search/db/upgrade.php Locally Modified (Based On 1.15)
@@ -83,5 +83,12 @@
         upgrade_block_savepoint(true, 2010110900, 'search');
     }
 
+    if ($oldversion < 2010111100) {
+        // set block to hidden if global search is disabled.
+        if ($CFG->enableglobalsearch != 1) {
+            $DB->set_field('block', 'visible', 0, array('name'=>'search'));     // Hide block
+        }
+        upgrade_block_savepoint(true, 2010111100, 'search');
+    }
     return $result;
 }
Index: moodle/blocks/search/version.php
--- moodle/blocks/search/version.php Base (1.3)
+++ moodle/blocks/search/version.php Locally Modified (Based On 1.3)
@@ -15,5 +15,5 @@
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-$plugin->version = 2010110900;
+$plugin->version = 2010111100;
 $plugin->cron = 1;
Index: moodle/search/lib.php
--- moodle/search/lib.php Base (1.22)
+++ moodle/search/lib.php Locally Modified (Based On 1.22)
@@ -186,4 +186,12 @@
     exit(0);
 }
 
+function search_updatedcallback($name) {
+    global $CFG, $DB;
+    // set block to hidden when global search is disabled.
+    if ($CFG->enableglobalsearch != 1) {
+        $DB->set_field('block', 'visible', 0, array('name'=>'search'));     // Hide block
+    }
+}
+
 ?>
