Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.1276 diff -u -p -r1.1276 common.inc --- includes/common.inc 15 Dec 2010 23:50:56 -0000 1.1276 +++ includes/common.inc 20 Dec 2010 17:25:39 -0000 @@ -7033,22 +7033,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.