summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-14 20:53:16 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2009-07-14 20:53:16 +0000
commit3472adb2ca21c815ff0fdbc63e21b03029fc051c (patch)
treec0989c3ad4bae4839bbcee42d5abfb9fb3fd939f
parentd76ec8f1d0c97ddbb67081bf6ed302e160ef879c (diff)
downloadbrdo-3472adb2ca21c815ff0fdbc63e21b03029fc051c.tar.gz
brdo-3472adb2ca21c815ff0fdbc63e21b03029fc051c.tar.bz2
#193366 by Anthony Hersey: Move various rebuild functions to module page submission rather than viewing for vastly increased performance.
-rw-r--r--modules/simpletest/tests/menu.test6
-rw-r--r--modules/simpletest/tests/menu_test.module19
-rw-r--r--modules/system/system.admin.inc10
3 files changed, 27 insertions, 8 deletions
diff --git a/modules/simpletest/tests/menu.test b/modules/simpletest/tests/menu.test
index d6593bace..34b3f4930 100644
--- a/modules/simpletest/tests/menu.test
+++ b/modules/simpletest/tests/menu.test
@@ -86,8 +86,10 @@ class MenuIncTestCase extends DrupalWebTestCase {
$name = db_query($sql)->fetchField();
$this->assertEqual($name, 'original', t('Menu name is "original".'));
- // Force a menu rebuild by going to the modules page.
- $this->drupalGet('admin/build/modules', array('query' => array("hook_menu_name" => 'changed')));
+ // Change the menu_name parameter in menu_test.module, then force a menu
+ // rebuild.
+ menu_test_menu_name('changed');
+ menu_rebuild();
$sql = "SELECT menu_name FROM {menu_links} WHERE router_path = 'menu_name_test'";
$name = db_query($sql)->fetchField();
diff --git a/modules/simpletest/tests/menu_test.module b/modules/simpletest/tests/menu_test.module
index 26114ef97..0428fd763 100644
--- a/modules/simpletest/tests/menu_test.module
+++ b/modules/simpletest/tests/menu_test.module
@@ -14,7 +14,7 @@ function menu_test_menu() {
$items['menu_name_test'] = array(
'title' => 'Test menu_name router item',
'page callback' => 'node_save',
- 'menu_name' => isset($_GET["hook_menu_name"]) ? $_GET["hook_menu_name"] : 'original',
+ 'menu_name' => menu_test_menu_name(),
);
// Use FALSE as 'title callback' to bypass t().
$items['menu_no_title_callback'] = array(
@@ -56,3 +56,20 @@ function menu_test_menu() {
function menu_test_callback() {
return $this->randomName();
}
+
+/**
+ * Helper function for the testMenuName() test. Used to change the menu_name
+ * parameter of a menu.
+ *
+ * @param $new_name
+ * If set, will change the menu_name value.
+ * @return
+ * The menu_name value to use.
+ */
+function menu_test_menu_name($new_name = '') {
+ static $name = 'original';
+ if ($new_name) {
+ $name = $new_name;
+ }
+ return $name;
+}
diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc
index 786e560fa..4bb1129bd 100644
--- a/modules/system/system.admin.inc
+++ b/modules/system/system.admin.inc
@@ -574,11 +574,6 @@ function _system_is_incompatible(&$incompatible, $files, $file) {
* The form array.
*/
function system_modules($form_state = array()) {
- // Clear all caches.
- registry_rebuild();
- drupal_theme_rebuild();
- node_types_rebuild();
- cache_clear_all('schema', 'cache');
// Get current list of modules.
$files = system_get_module_data();
@@ -931,6 +926,11 @@ function system_modules_submit($form, &$form_state) {
drupal_set_message(t('The configuration options have been saved.'));
}
+ // Clear all caches.
+ registry_rebuild();
+ drupal_theme_rebuild();
+ node_types_rebuild();
+ cache_clear_all('schema', 'cache');
drupal_clear_css_cache();
drupal_clear_js_cache();