diff --git a/includes/common.inc b/includes/common.inc index a05a09a..35a9d9e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7145,24 +7145,30 @@ function drupal_flush_all_caches() { // Rebuild the theme data. Note that the module data is rebuilt above, as // part of registry_rebuild(). system_rebuild_theme_data(); - drupal_theme_rebuild(); - node_types_rebuild(); - // node_menu() defines menu items based on node types so it needs to come - // after node types are rebuilt. - menu_rebuild(); + // Now clear all static caches as well as all cache bins. + drupal_static_reset(); - // Synchronize to catch any actions that were added or removed. - actions_synchronize(); + // First clear all cache bins of core, then invoke hook_flush_caches() to get + // contrib cache bins to clear. That way we ensure core caches are cleared + // before an contrib might trigger any cache rebuild in an implementation of + // hook_flush_caches(). // Don't clear cache_form - in-progress form submissions may break. // Ordered so clearing the page cache will always be the last action. - $core = array('cache', 'path', 'filter', 'bootstrap', 'page'); - $cache_bins = array_merge(module_invoke_all('flush_caches'), $core); - foreach ($cache_bins as $bin) { + foreach (array('bootstrap', 'cache', 'path', 'filter', 'page') as $bin) { + cache($bin)->flush(); + } + foreach (module_invoke_all('flush_caches') as $bin) { cache($bin)->flush(); } + // Menu rebuilding is going to trigger lots of cache rebuilds. + menu_rebuild(); + + // Synchronize to catch any actions that were added or removed. + actions_synchronize(); + // Rebuild the bootstrap module list. We do this here so that developers // can get new hook_boot() implementations registered without having to // write a hook_update_N() function. diff --git a/modules/node/node.module b/modules/node/node.module index 0c3cfb7..4b642c8 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -736,7 +736,9 @@ function _node_types_build($rebuild = FALSE) { } asort($_node_types->names); - + // Set caches. + $static = &drupal_static(__FUNCTION__); + $static = $_node_types; cache()->set($cid, $_node_types); return $_node_types; @@ -1952,10 +1954,6 @@ function node_menu() { 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); - // @todo Remove this loop when we have a 'description callback' property. - // Reset internal static cache of _node_types_build(), forces to rebuild the - // node type information. - node_type_cache_reset(); foreach (node_type_get_types() as $type) { $type_url_str = str_replace('_', '-', $type->type); $items['node/add/' . $type_url_str] = array( @@ -3893,6 +3891,14 @@ function node_modules_enabled($modules) { if (!node_access_needs_rebuild() && array_intersect($modules, module_implements('node_grants'))) { node_access_needs_rebuild(TRUE); } + node_types_rebuild(); +} + +/** + * Implements hook_modules_disabled(). + */ +function node_modules_disabled($modules) { + node_types_rebuild(); } /**