From 7139f0253c080b20c1558f9fb656bbec4d59bc37 Mon Sep 17 00:00:00 2001 From: Larry Garfield Date: Sat, 11 Aug 2012 17:59:13 -0500 Subject: [PATCH] Add a new-router rebuild step to the global flush operation. --- core/includes/common.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/includes/common.inc b/core/includes/common.inc index aea8529060..6300dece78 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -6829,6 +6829,7 @@ function drupal_flush_all_caches() { // Rebuild the menu router based on all rebuilt data. // Important: This rebuild must happen last, so the menu router is guaranteed // to be based on up to date information. + router_rebuild(); menu_router_rebuild(); // Re-initialize the maintenance theme, if the current request attempted to @@ -6840,6 +6841,21 @@ function drupal_flush_all_caches() { } } +function router_rebuild() { + // We need to manually call each module so that we can know which module + // a given item came from. + $callbacks = array(); + + $dumper = drupal_container()->get('router.dumper'); + + foreach (module_implements('route_info') as $module) { + $routes = call_user_func($module . '_route_info'); + drupal_alter('router_info', $routes); + $dumper->addRoutes($routes); + $dumper->dump(array('route_set' => $module)); + } +} + /** * Changes the dummy query string added to all CSS and JavaScript files. * -- GitLab