From 7bf28b42eb01e4503ccbcda3463603afe0e7abd9 Mon Sep 17 00:00:00 2001 From: Bob Vincent Date: Fri, 27 May 2011 20:34:43 -0400 Subject: [PATCH] Issue #996236 by sun: Clear entity cache in drupal_flush_all_caches(). --- includes/common.inc | 29 +++++++++++++++++++++-------- 1 files changed, 21 insertions(+), 8 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 95e03e8cc93e6d41ee5780e9019bd9e50607f547..d5e6d7d99c4d03240f3226eff4832b6303247dfa 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7118,22 +7118,35 @@ function drupal_flush_all_caches() { system_rebuild_theme_data(); drupal_theme_rebuild(); + // Ensure that all rebuilds that may rely on entity information and other + // static caches act on fresh data. + // block_flush_caches() invokes _block_rehash(), which in turn may rely on + // entity information. + entity_info_cache_clear(); + + // Don't clear cache_form - in-progress form submissions may break. + // Ordered so clearing the page cache will always be the last action. + $core_cache = array('cache', 'cache_filter', 'cache_bootstrap', 'cache_page'); + $other_cache = array_diff(module_invoke_all('flush_caches'), $core_cache); + foreach ($other_cache as $table) { + cache_clear_all('*', $table, TRUE); + } + + // Rebuilding node types and menu may rely on entity information, so rebuilds + // need to happen after flushing static and database caches. node_types_rebuild(); // node_menu() defines menu items based on node types so it needs to come // after node types are rebuilt. menu_rebuild(); + // Move cache_page after menu_rebuild(). + foreach ($core_cache as $table) { + cache_clear_all('*', $table, TRUE); + } + // Synchronize to catch any actions that were added or removed. actions_synchronize(); - // 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', 'cache_filter', 'cache_bootstrap', 'cache_page'); - $cache_tables = array_merge(module_invoke_all('flush_caches'), $core); - foreach ($cache_tables as $table) { - cache_clear_all('*', $table, TRUE); - } - // 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. -- 1.7.4.1