#193366 by Anthony Hersey: Move various rebuild functions to module page submission rather than viewing for vastly increased performance.

merge-requests/26/head
Angie Byron 2009-07-14 20:53:16 +00:00
parent d76ec8f1d0
commit 3472adb2ca
3 changed files with 27 additions and 8 deletions

View File

@ -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();

View File

@ -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;
}

View File

@ -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();