diff --git a/includes/common.inc b/includes/common.inc index 89a2c4a365..57fd73c06e 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -7656,8 +7656,11 @@ function drupal_implode_tags($tags) { * * Empties cache tables, rebuilds the menu cache and theme registries, and * invokes a hook so that other modules' cache data can be cleared as well. + * + * @param $force + * Force a full menu rebuild even if {menu_router} didn't change. */ -function drupal_flush_all_caches() { +function drupal_flush_all_caches($force = FALSE) { // Change query-strings on css/js files to enforce reload for all users. _drupal_flush_css_js(); @@ -7674,7 +7677,7 @@ function drupal_flush_all_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(); + menu_rebuild($force); // Synchronize to catch any actions that were added or removed. actions_synchronize(); diff --git a/modules/system/system.admin.inc b/modules/system/system.admin.inc index b7e6fc9e70..0f91242c27 100644 --- a/modules/system/system.admin.inc +++ b/modules/system/system.admin.inc @@ -1700,6 +1700,12 @@ function system_performance_settings() { '#submit' => array('system_clear_cache_submit'), ); + $form['clear_cache']['clear_rebuild'] = array( + '#type' => 'submit', + '#value' => t('Clear all caches and rebuild menu'), + '#submit' => array('system_clear_cache_rebuild_submit'), + ); + $form['caching'] = array( '#type' => 'fieldset', '#title' => t('Caching'), @@ -1783,6 +1789,16 @@ function system_clear_cache_submit($form, &$form_state) { drupal_set_message(t('Caches cleared.')); } +/** + * Submit callback; clear system caches and rebuild menu. + * + * @ingroup forms + */ +function system_clear_cache_rebuild_submit($form, &$form_state) { + drupal_flush_all_caches(TRUE); + drupal_set_message(t('Caches cleared and menu rebuild.')); +} + /** * Submit callback; clear the page cache. *