Commit 3472adb2 authored by webchick's avatar webchick
Browse files

#193366 by Anthony Hersey: Move various rebuild functions to module page...

#193366 by Anthony Hersey: Move various rebuild functions to module page submission rather than viewing for vastly increased performance.
parent d76ec8f1
......@@ -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();
......
......@@ -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;
}
......@@ -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();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment