Index: includes/bootstrap.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v retrieving revision 1.209 diff -u -r1.209 bootstrap.inc --- includes/bootstrap.inc 6 May 2008 12:18:45 -0000 1.209 +++ includes/bootstrap.inc 13 May 2008 11:22:03 -0000 @@ -519,7 +519,6 @@ */ function bootstrap_invoke_all($hook) { foreach (module_list(TRUE, TRUE) as $module) { - drupal_load('module', $module); module_invoke($module, $hook); } } @@ -1285,7 +1284,11 @@ } if ($write_to_persistent_cache === TRUE) { - cache_set('hooks', $implementations, 'cache_registry'); + // Only write this to cache if the implementations data we are going to cache + // is different to what we loaded earlier in the request. + if ($implementations != registry_get_hook_implementations_cache()) { + cache_set('hooks', $implementations, 'cache_registry'); + } } } @@ -1307,12 +1310,53 @@ $files[] = $row->filename; } if ($files) { - $menu = menu_get_item(); - cache_set('registry:' . $menu['path'], implode(';', $files), 'cache_registry'); + sort($files); + // Only write this to cache if the file list we are going to cache + // is different to what we loaded earlier in the request. + if ($files != registry_load_path_files(TRUE)) { + $menu = menu_get_item(); + cache_set('registry:' . $menu['path'], implode(';', $files), 'cache_registry'); + } + } + } +} + +/** + * registry_load_path_files + */ +function registry_load_path_files($return = FALSE) { + static $file_cache_data; + if ($return) { + sort($file_cache_data); + return $file_cache_data; + } + $menu = menu_get_item(); + $cache = cache_get('registry:' . $menu['path'], 'cache_registry'); + if (!empty($cache->data)) { + foreach(explode(';', $cache->data) as $file) { + require_once($file); + $file_cache_data[] = $file; } } } /** + * registry_get_hook_implementations_cache + */ +function registry_get_hook_implementations_cache() { + static $implementations; + if ($implementations === NULL) { + if ($cache = cache_get('hooks', 'cache_registry')) { + $implementations = $cache->data; + } + else { + $implementations = array(); + } + } + return $implementations; +} + +/** * @} End of "ingroup registry". */ + Index: includes/module.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/module.inc,v retrieving revision 1.119 diff -u -r1.119 module.inc --- includes/module.inc 7 May 2008 06:39:57 -0000 1.119 +++ includes/module.inc 13 May 2008 11:22:10 -0000 @@ -408,9 +408,7 @@ $implementations = array(); } else if (!defined('MAINTENANCE_MODE') && empty($implementations)) { - if ($cache = cache_get('hooks', 'cache_registry')) { - $implementations = $cache->data; - } + $implementations = registry_get_hook_implementations_cache(); } if (!isset($implementations[$hook])) {