From 4e0f6ffed33a08879e5a6ccefbb063b0547ddf9e 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 | 23 ++++++++++++++++------- 1 files changed, 16 insertions(+), 7 deletions(-) diff --git a/includes/common.inc b/includes/common.inc index 95e03e8cc93e6d41ee5780e9019bd9e50607f547..2435e6636f254167206ff536de88a0f71af02ad4 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7118,22 +7118,31 @@ function drupal_flush_all_caches() { 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(); - - // Synchronize to catch any actions that were added or removed. - actions_synchronize(); + // 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. + drupal_static_reset(); // Don't clear cache_form - in-progress form submissions may break. // Ordered so clearing the page cache will always be the last action. + // @todo Consider to move cache_page after menu_rebuild(). $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); } + // 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(); + + // 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. -- 1.7.4.1