diff --git a/core/includes/common.inc b/core/includes/common.inc index aea8529060a7aece2f29e36482a7d806e8186f6b..6300dece781bb5791e68f9fda72b087b73e232c0 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. *