Commit 4e0e15b2 authored by catch's avatar catch

Issue #2352641 by chx, alexpott: Break router.builder dependency.

parent 06e18f51
...@@ -290,7 +290,7 @@ services: ...@@ -290,7 +290,7 @@ services:
arguments: ['%container.modules%', '@cache.bootstrap'] arguments: ['%container.modules%', '@cache.bootstrap']
theme_handler: theme_handler:
class: Drupal\Core\Extension\ThemeHandler class: Drupal\Core\Extension\ThemeHandler
arguments: ['@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder'] arguments: ['@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder_indicator']
entity.manager: entity.manager:
class: Drupal\Core\Entity\EntityManager class: Drupal\Core\Entity\EntityManager
arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed'] arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed']
...@@ -529,9 +529,12 @@ services: ...@@ -529,9 +529,12 @@ services:
arguments: ['@database', '@state'] arguments: ['@database', '@state']
tags: tags:
- { name: backend_overridable } - { name: backend_overridable }
router.builder_indicator:
class: Drupal\Core\Routing\RouteBuilderIndicator
arguments: ['@state']
router.builder: router.builder:
class: Drupal\Core\Routing\RouteBuilder class: Drupal\Core\Routing\RouteBuilder
arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@state'] arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@router.builder_indicator']
router.rebuild_subscriber: router.rebuild_subscriber:
class: Drupal\Core\EventSubscriber\RouterRebuildSubscriber class: Drupal\Core\EventSubscriber\RouterRebuildSubscriber
arguments: ['@router.builder'] arguments: ['@router.builder']
......
...@@ -812,7 +812,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { ...@@ -812,7 +812,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
// Clear plugin manager caches and flag router to rebuild if requested. // Clear plugin manager caches and flag router to rebuild if requested.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions(); \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Set the schema version to the number of the last update provided by // Set the schema version to the number of the last update provided by
// the module, or the minimum core schema version. // the module, or the minimum core schema version.
...@@ -1002,7 +1002,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { ...@@ -1002,7 +1002,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
// Clear plugin manager caches and flag router to rebuild if requested. // Clear plugin manager caches and flag router to rebuild if requested.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions(); \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Update the kernel to exclude the uninstalled modules. // Update the kernel to exclude the uninstalled modules.
\Drupal::service('kernel')->updateModules($module_filenames, $module_filenames); \Drupal::service('kernel')->updateModules($module_filenames, $module_filenames);
......
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Config\ConfigInstallerInterface;
use Drupal\Core\Config\ConfigManagerInterface; use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Routing\RouteBuilderIndicatorInterface;
use Drupal\Core\State\StateInterface; use Drupal\Core\State\StateInterface;
use Drupal\Core\Routing\RouteBuilder;
use Psr\Log\LoggerInterface; use Psr\Log\LoggerInterface;
/** /**
...@@ -87,11 +87,11 @@ class ThemeHandler implements ThemeHandlerInterface { ...@@ -87,11 +87,11 @@ class ThemeHandler implements ThemeHandlerInterface {
protected $logger; protected $logger;
/** /**
* The route builder to rebuild the routes if a theme is installed. * The route builder indicator to rebuild the routes if a theme is installed.
* *
* @var \Drupal\Core\Routing\RouteBuilder * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
*/ */
protected $routeBuilder; protected $routeBuilderIndicator;
/** /**
* An extension discovery instance. * An extension discovery instance.
...@@ -135,13 +135,13 @@ class ThemeHandler implements ThemeHandlerInterface { ...@@ -135,13 +135,13 @@ class ThemeHandler implements ThemeHandlerInterface {
* database. * database.
* @param \Drupal\Core\Config\ConfigManagerInterface $config_manager * @param \Drupal\Core\Config\ConfigManagerInterface $config_manager
* The config manager used to uninstall a theme. * The config manager used to uninstall a theme.
* @param \Drupal\Core\Routing\RouteBuilder $route_builder * @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_builder_indicator
* (optional) The route builder to rebuild the routes if a theme is * (optional) The route builder indicator service to rebuild the routes if a
* installed. * theme is installed.
* @param \Drupal\Core\Extension\ExtensionDiscovery $extension_discovery * @param \Drupal\Core\Extension\ExtensionDiscovery $extension_discovery
* (optional) A extension discovery instance (for unit tests). * (optional) A extension discovery instance (for unit tests).
*/ */
public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, ConfigManagerInterface $config_manager = NULL, RouteBuilder $route_builder = NULL, ExtensionDiscovery $extension_discovery = NULL) { public function __construct(ConfigFactoryInterface $config_factory, ModuleHandlerInterface $module_handler, StateInterface $state, InfoParserInterface $info_parser,LoggerInterface $logger, AssetCollectionOptimizerInterface $css_collection_optimizer = NULL, ConfigInstallerInterface $config_installer = NULL, ConfigManagerInterface $config_manager = NULL, RouteBuilderIndicatorInterface $route_builder_indicator = NULL, ExtensionDiscovery $extension_discovery = NULL) {
$this->configFactory = $config_factory; $this->configFactory = $config_factory;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->state = $state; $this->state = $state;
...@@ -150,7 +150,7 @@ public function __construct(ConfigFactoryInterface $config_factory, ModuleHandle ...@@ -150,7 +150,7 @@ public function __construct(ConfigFactoryInterface $config_factory, ModuleHandle
$this->cssCollectionOptimizer = $css_collection_optimizer; $this->cssCollectionOptimizer = $css_collection_optimizer;
$this->configInstaller = $config_installer; $this->configInstaller = $config_installer;
$this->configManager = $config_manager; $this->configManager = $config_manager;
$this->routeBuilder = $route_builder; $this->routeBuilderIndicator = $route_builder_indicator;
$this->extensionDiscovery = $extension_discovery; $this->extensionDiscovery = $extension_discovery;
} }
...@@ -648,8 +648,8 @@ protected function getExtensionDiscovery() { ...@@ -648,8 +648,8 @@ protected function getExtensionDiscovery() {
* Resets some other systems like rebuilding the route information or caches. * Resets some other systems like rebuilding the route information or caches.
*/ */
protected function resetSystem() { protected function resetSystem() {
if ($this->routeBuilder) { if ($this->routeBuilderIndicator) {
$this->routeBuilder->setRebuildNeeded(); $this->routeBuilderIndicator->setRebuildNeeded();
} }
$this->systemListReset(); $this->systemListReset();
......
...@@ -58,6 +58,13 @@ class RouteBuilder implements RouteBuilderInterface { ...@@ -58,6 +58,13 @@ class RouteBuilder implements RouteBuilderInterface {
*/ */
protected $moduleHandler; protected $moduleHandler;
/**
* The route builder indicator.
*
* @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
*/
protected $routeBuilderIndicator;
/** /**
* The controller resolver. * The controller resolver.
* *
...@@ -92,16 +99,16 @@ class RouteBuilder implements RouteBuilderInterface { ...@@ -92,16 +99,16 @@ class RouteBuilder implements RouteBuilderInterface {
* The module handler. * The module handler.
* @param \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver * @param \Drupal\Core\Controller\ControllerResolverInterface $controller_resolver
* The controller resolver. * The controller resolver.
* @param \Drupal\Core\KeyValueStore\StateInterface $state * @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_build_indicator
* The state. * The route build indicator.
*/ */
public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, StateInterface $state = NULL) { public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, RouteBuilderIndicatorInterface $route_build_indicator = NULL) {
$this->dumper = $dumper; $this->dumper = $dumper;
$this->lock = $lock; $this->lock = $lock;
$this->dispatcher = $dispatcher; $this->dispatcher = $dispatcher;
$this->moduleHandler = $module_handler; $this->moduleHandler = $module_handler;
$this->controllerResolver = $controller_resolver; $this->controllerResolver = $controller_resolver;
$this->state = $state; $this->routeBuilderIndicator = $route_build_indicator;
} }
/** /**
...@@ -175,7 +182,7 @@ public function rebuild() { ...@@ -175,7 +182,7 @@ public function rebuild() {
$this->dumper->addRoutes($collection); $this->dumper->addRoutes($collection);
$this->dumper->dump(); $this->dumper->dump();
$this->state->delete(static::REBUILD_NEEDED); $this->routeBuilderIndicator->setRebuildDone();
$this->lock->release('router_rebuild'); $this->lock->release('router_rebuild');
$this->dispatcher->dispatch(RoutingEvents::FINISHED, new Event()); $this->dispatcher->dispatch(RoutingEvents::FINISHED, new Event());
$this->building = FALSE; $this->building = FALSE;
...@@ -196,7 +203,7 @@ public function getCollectionDuringRebuild() { ...@@ -196,7 +203,7 @@ public function getCollectionDuringRebuild() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function rebuildIfNeeded() { public function rebuildIfNeeded() {
if ($this->state->get(static::REBUILD_NEEDED, FALSE)) { if ($this->routeBuilderIndicator->isRebuildNeeded()) {
return $this->rebuild(); return $this->rebuild();
} }
return FALSE; return FALSE;
...@@ -206,7 +213,7 @@ public function rebuildIfNeeded() { ...@@ -206,7 +213,7 @@ public function rebuildIfNeeded() {
* {@inheritdoc} * {@inheritdoc}
*/ */
public function setRebuildNeeded() { public function setRebuildNeeded() {
$this->state->set(static::REBUILD_NEEDED, TRUE); $this->routeBuilderIndicator->setRebuildNeeded();
} }
/** /**
......
<?php
/**
* @file
* Contains \Drupal\Core\Routing\RouteBuilderIndicator.
*/
namespace Drupal\Core\Routing;
use Drupal\Core\State\StateInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
/**
* A simple service to be used instead of the route builder.
*
* The route builder service is required by quite a few other services,
* however it has a lot of dependencies. Use this service to ensure that the
* router is rebuilt.
*/
class RouteBuilderIndicator implements RouteBuilderIndicatorInterface {
/**
* @var \Drupal\Core\State\StateInterface
*/
protected $state;
/**
* @param \Drupal\Core\State\StateInterface $state
*/
public function __construct(StateInterface $state) {
$this->state = $state;
}
/**
* {@inheritdoc}
*/
public function setRebuildNeeded() {
$this->state->set(static::REBUILD_NEEDED, TRUE);
}
/**
* {@inheritdoc}
*/
public function isRebuildNeeded() {
return $this->state->get(static::REBUILD_NEEDED, FALSE);
}
/**
* {@inheritdoc}
*/
public function setRebuildDone() {
$this->state->set(static::REBUILD_NEEDED, FALSE);
}
}
<?php
/**
* @file
* Definition of Drupal\Core\Routing\RouteBuilderIndicatorInterface.
*/
namespace Drupal\Core\Routing;
interface RouteBuilderIndicatorInterface {
/**
* The state key to use.
*/
const REBUILD_NEEDED = 'router_rebuild_needed';
/**
* Sets the router to be rebuilt next time the kernel is terminated.
*
* @see \Drupal\Core\EventSubscriber\RouterRebuildSubscriber::onKernelTerminate()
* @see \Drupal\Core\Routing\RouteBuilderInterface::rebuildIfNeeded()
*
*/
public function setRebuildNeeded();
/**
* Sets the router rebuild indicator to FALSE.
*/
public function setRebuildDone();
/**
* Checks if the router needs to be rebuilt.
*
* @return bool
* TRUE if the router needs to be rebuilt, FALSE if not.
*/
public function isRebuildNeeded();
}
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
interface RouteBuilderInterface { interface RouteBuilderInterface {
const REBUILD_NEEDED = 'router_rebuild_needed';
/** /**
* Rebuilds the route info and dumps to dumper. * Rebuilds the route info and dumps to dumper.
* *
......
...@@ -337,5 +337,5 @@ function content_translation_form_language_content_settings_submit(array $form, ...@@ -337,5 +337,5 @@ function content_translation_form_language_content_settings_submit(array $form,
// Ensure entity and menu router information are correctly rebuilt. // Ensure entity and menu router information are correctly rebuilt.
\Drupal::entityManager()->clearCachedDefinitions(); \Drupal::entityManager()->clearCachedDefinitions();
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
...@@ -701,7 +701,7 @@ function content_translation_language_configuration_element_submit(array $form, ...@@ -701,7 +701,7 @@ function content_translation_language_configuration_element_submit(array $form,
if (content_translation_enabled($context['entity_type'], $context['bundle']) != $enabled) { if (content_translation_enabled($context['entity_type'], $context['bundle']) != $enabled) {
content_translation_set_config($context['entity_type'], $context['bundle'], 'enabled', $enabled); content_translation_set_config($context['entity_type'], $context['bundle'], 'enabled', $enabled);
\Drupal::entityManager()->clearCachedDefinitions(); \Drupal::entityManager()->clearCachedDefinitions();
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
} }
......
...@@ -98,7 +98,7 @@ function field_ui_entity_type_build(array &$entity_types) { ...@@ -98,7 +98,7 @@ function field_ui_entity_type_build(array &$entity_types) {
function field_ui_entity_bundle_create($entity_type, $bundle) { function field_ui_entity_bundle_create($entity_type, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add our // When a new bundle is created, the menu needs to be rebuilt to add our
// menu item tabs. // menu item tabs.
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
...@@ -107,7 +107,7 @@ function field_ui_entity_bundle_create($entity_type, $bundle) { ...@@ -107,7 +107,7 @@ function field_ui_entity_bundle_create($entity_type, $bundle) {
function field_ui_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) { function field_ui_entity_bundle_rename($entity_type, $bundle_old, $bundle_new) {
// When a bundle is renamed, the menu needs to be rebuilt to add our // When a bundle is renamed, the menu needs to be rebuilt to add our
// menu item tabs. // menu item tabs.
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
...@@ -182,14 +182,14 @@ function field_ui_form_node_type_form_submit($form, FormStateInterface $form_sta ...@@ -182,14 +182,14 @@ function field_ui_form_node_type_form_submit($form, FormStateInterface $form_sta
* Implements hook_view_mode_presave(). * Implements hook_view_mode_presave().
*/ */
function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) { function field_ui_view_mode_presave(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
* Implements hook_view_mode_delete(). * Implements hook_view_mode_delete().
*/ */
function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) { function field_ui_view_mode_delete(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
......
...@@ -21,5 +21,5 @@ function menu_ui_install() { ...@@ -21,5 +21,5 @@ function menu_ui_install() {
* Implements hook_uninstall(). * Implements hook_uninstall().
*/ */
function menu_ui_uninstall() { function menu_ui_uninstall() {
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
...@@ -961,7 +961,7 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo ...@@ -961,7 +961,7 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo
\Drupal::config('node.settings') \Drupal::config('node.settings')
->set('use_admin_theme', $form_state->getValue('use_admin_theme')) ->set('use_admin_theme', $form_state->getValue('use_admin_theme'))
->save(); ->save();
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
......
...@@ -184,7 +184,7 @@ public function postCreate(EntityStorageInterface $storage) { ...@@ -184,7 +184,7 @@ public function postCreate(EntityStorageInterface $storage) {
*/ */
public function postSave(EntityStorageInterface $storage, $update = TRUE) { public function postSave(EntityStorageInterface $storage, $update = TRUE) {
parent::postSave($storage, $update); parent::postSave($storage, $update);
$this->routeBuilder()->setRebuildNeeded(); $this->routeBuilderIndicator()->setRebuildNeeded();
} }
/** /**
...@@ -216,11 +216,11 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b) ...@@ -216,11 +216,11 @@ public static function sort(ConfigEntityInterface $a, ConfigEntityInterface $b)
/** /**
* Wraps the route builder. * Wraps the route builder.
* *
* @return \Drupal\Core\Routing\RouteBuilderInterface * @return \Drupal\Core\Routing\RouteBuilderIndicatorInterface
* An object for state storage. * An object for state storage.
*/ */
protected function routeBuilder() { protected function routeBuilderIndicator() {
return \Drupal::service('router.builder'); return \Drupal::service('router.builder_indicator');
} }
/** /**
......
...@@ -723,7 +723,7 @@ function hook_entity_bundle_info_alter(&$bundles) { ...@@ -723,7 +723,7 @@ function hook_entity_bundle_info_alter(&$bundles) {
function hook_entity_bundle_create($entity_type_id, $bundle) { function hook_entity_bundle_create($entity_type_id, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add the // When a new bundle is created, the menu needs to be rebuilt to add the
// Field UI menu item tabs. // Field UI menu item tabs.
\Drupal::service('router.builder')->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
} }
/** /**
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
use Drupal\Core\Controller\ControllerBase; use Drupal\Core\Controller\ControllerBase;
use Drupal\Core\Extension\ThemeHandlerInterface; use Drupal\Core\Extension\ThemeHandlerInterface;
use Drupal\Core\Routing\RouteBuilderInterface; use Drupal\Core\Routing\RouteBuilderIndicatorInterface;
use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
...@@ -29,21 +29,21 @@ class ThemeController extends ControllerBase { ...@@ -29,21 +29,21 @@ class ThemeController extends ControllerBase {
/** /**
* The route builder service. * The route builder service.
* *
* @var \Drupal\Core\Routing\RouteBuilderInterface * @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
*/ */
protected $routeBuilder; protected $routeBuilderIndicator;
/** /**
* Constructs a new ThemeController. * Constructs a new ThemeController.
* *
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler * @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler. * The theme handler.
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder * @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder_indicator
* The route builder. * The route builder.
*/ */
public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderInterface $route_builder) { public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderIndicatorInterface $route_builder_indicator) {
$this->themeHandler = $theme_handler; $this->themeHandler = $theme_handler;
$this->routeBuilder = $route_builder; $this->routeBuilderIndicator = $route_builder_indicator;
} }
/** /**
...@@ -52,7 +52,7 @@ public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderIn ...@@ -52,7 +52,7 @@ public function __construct(ThemeHandlerInterface $theme_handler, RouteBuilderIn
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('theme_handler'), $container->get('theme_handler'),
$container->get('router.builder') $container->get('router.builder_indicator')
); );
} }
...@@ -157,7 +157,7 @@ public function setDefaultTheme(Request $request) { ...@@ -157,7 +157,7 @@ public function setDefaultTheme(Request $request) {
// Set the default theme. // Set the default theme.
$config->set('default', $theme)->save(); $config->set('default', $theme)->save();
$this->routeBuilder->setRebuildNeeded(); $this->routeBuilderIndicator->setRebuildNeeded();
// The status message depends on whether an admin theme is currently in // The status message depends on whether an admin theme is currently in
// use: a value of 0 means the admin theme is set to be the default // use: a value of 0 means the admin theme is set to be the default
......
...@@ -1393,11 +1393,9 @@ function user_modules_installed($modules) { ...@@ -1393,11 +1393,9 @@ function user_modules_installed($modules) {
// Assign all available permissions to the administrator role. // Assign all available permissions to the administrator role.
$rid = \Drupal::config('user.settings')->get('admin_role'); $rid = \Drupal::config('user.settings')->get('admin_role');
if ($rid) { if ($rid) {
/** @var \Drupal\Core\Routing\RouteBuilderInterface $route_builder */
$route_builder = \Drupal::service('router.builder');
// Some permissions call the url generator, so ensure that the routes are // Some permissions call the url generator, so ensure that the routes are
// up to date. // up to date.
$route_builder->setRebuildNeeded(); \Drupal::service('router.builder_indicator')->setRebuildNeeded();
/** @var \Drupal\user\PermissionHandlerInterface $permission_handler */