Commit 40d57b3d authored by alexpott's avatar alexpott

Issue #356399 by dawehner, beejeebus, catch, sidharrell, klausi, nlisgo, Josh...

Issue #356399 by dawehner, beejeebus, catch, sidharrell, klausi, nlisgo, Josh Waihi, Berdir, martin107: Optimize the route rebuilding process to rebuild on write
parent 260f9367
......@@ -343,7 +343,7 @@ services:
arguments: ['@entity.manager', '@string_translation']
theme_handler:
class: Drupal\Core\Extension\ThemeHandler
arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder_indicator']
arguments: ['@app.root', '@config.factory', '@module_handler', '@state', '@info_parser', '@logger.channel.default', '@asset.css.collection_optimizer', '@config.installer', '@config.manager', '@router.builder']
entity.manager:
class: Drupal\Core\Entity\EntityManager
arguments: ['@container.namespaces', '@module_handler', '@cache.discovery', '@language_manager', '@string_translation', '@class_resolver', '@typed_data_manager', '@entity.definitions.installed', '@event_dispatcher']
......@@ -553,7 +553,7 @@ services:
arguments: ['@current_route_match']
router.route_provider:
class: Drupal\Core\Routing\RouteProvider
arguments: ['@database', '@router.builder', '@state', '@path.current']
arguments: ['@database', '@state', '@path.current']
tags:
- { name: event_subscriber }
- { name: backend_overridable }
......@@ -635,17 +635,11 @@ services:
arguments: ['@database', '@state']
tags:
- { name: backend_overridable }
router.builder_indicator:
class: Drupal\Core\Routing\RouteBuilderIndicator
arguments: ['@state']
router.builder:
class: Drupal\Core\Routing\RouteBuilder
arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@access_manager.check_provider', '@router.builder_indicator']
router.rebuild_subscriber:
class: Drupal\Core\EventSubscriber\RouterRebuildSubscriber
arguments: ['@router.builder']
arguments: ['@router.dumper', '@lock', '@event_dispatcher', '@module_handler', '@controller_resolver', '@access_manager.check_provider']
tags:
- { name: event_subscriber }
- { name: needs_destruction }
menu.rebuild_subscriber:
class: Drupal\Core\EventSubscriber\MenuRouterRebuildSubscriber
arguments: ['@lock', '@plugin.manager.menu.link']
......
......@@ -19,11 +19,6 @@
*/
class MenuRouterRebuildSubscriber implements EventSubscriberInterface {
/**
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;
/**
* @var \Drupal\Core\Lock\LockBackendInterface
*/
......
......@@ -220,9 +220,8 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
// Now install the module's schema if necessary.
drupal_install_schema($module);
// Clear plugin manager caches and flag router to rebuild if requested.
// Clear plugin manager caches.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Set the schema version to the number of the last update provided by
// the module, or the minimum core schema version.
......@@ -296,6 +295,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) {
// If any modules were newly installed, invoke hook_modules_installed().
if (!empty($modules_installed)) {
\Drupal::service('router.builder')->rebuild();
$this->moduleHandler->invokeAll('modules_installed', array($modules_installed));
}
......@@ -417,9 +417,8 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
// its statically cached list.
drupal_static_reset('system_rebuild_module_data');
// Clear plugin manager caches and flag router to rebuild if requested.
// Clear plugin manager caches.
\Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
// Update the kernel to exclude the uninstalled modules.
$this->updateKernel($module_filenames);
......@@ -438,6 +437,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) {
$schema_store = \Drupal::keyValue('system.schema');
$schema_store->delete($module);
}
\Drupal::service('router.builder')->rebuild();
drupal_get_installed_schema_version(NULL, TRUE);
// Let other modules react.
......
......@@ -14,7 +14,7 @@
use Drupal\Core\Config\ConfigInstallerInterface;
use Drupal\Core\Config\ConfigManagerInterface;
use Drupal\Core\Config\PreExistingConfigException;
use Drupal\Core\Routing\RouteBuilderIndicatorInterface;
use Drupal\Core\Routing\RouteBuilderInterface;
use Drupal\Core\State\StateInterface;
use Psr\Log\LoggerInterface;
......@@ -88,11 +88,11 @@ class ThemeHandler implements ThemeHandlerInterface {
protected $logger;
/**
* The route builder indicator to rebuild the routes if a theme is installed.
* The route builder to rebuild the routes if a theme is installed.
*
* @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilderIndicator;
protected $routeBuilder;
/**
* An extension discovery instance.
......@@ -145,13 +145,13 @@ class ThemeHandler implements ThemeHandlerInterface {
* database.
* @param \Drupal\Core\Config\ConfigManagerInterface $config_manager
* The config manager used to uninstall a theme.
* @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_builder_indicator
* (optional) The route builder indicator service to rebuild the routes if a
* theme is installed.
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* (optional) The route builder service to rebuild the routes if a theme is
* installed.
* @param \Drupal\Core\Extension\ExtensionDiscovery $extension_discovery
* (optional) A extension discovery instance (for unit tests).
*/
public function __construct($root, 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) {
public function __construct($root, 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, RouteBuilderInterface $route_builder = NULL, ExtensionDiscovery $extension_discovery = NULL) {
$this->root = $root;
$this->configFactory = $config_factory;
$this->moduleHandler = $module_handler;
......@@ -161,7 +161,7 @@ public function __construct($root, ConfigFactoryInterface $config_factory, Modul
$this->cssCollectionOptimizer = $css_collection_optimizer;
$this->configInstaller = $config_installer;
$this->configManager = $config_manager;
$this->routeBuilderIndicator = $route_builder_indicator;
$this->routeBuilder = $route_builder;
$this->extensionDiscovery = $extension_discovery;
}
......@@ -624,8 +624,8 @@ protected function getExtensionDiscovery() {
* Resets some other systems like rebuilding the route information or caches.
*/
protected function resetSystem() {
if ($this->routeBuilderIndicator) {
$this->routeBuilderIndicator->setRebuildNeeded();
if ($this->routeBuilder) {
$this->routeBuilder->setRebuildNeeded();
}
$this->systemListReset();
......
......@@ -201,9 +201,6 @@ public function getLocalTasksForRoute($route_name) {
$children = $cache->data['children'];
}
else {
// Maybe some code asked to rebuild the routes, so rebuild the router
// as we rely on having proper existing routes in dynamic local tasks.
$this->routeBuilder->rebuildIfNeeded();
$definitions = $this->getDefinitions();
// We build the hierarchy by finding all tabs that should
// appear on the current route.
......
......@@ -12,6 +12,7 @@
use Drupal\Core\Controller\ControllerResolverInterface;
use Drupal\Core\Extension\ModuleHandlerInterface;
use Drupal\Core\Lock\LockBackendInterface;
use Drupal\Core\DestructableInterface;
use Symfony\Component\EventDispatcher\Event;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\Routing\RouteCollection;
......@@ -20,7 +21,7 @@
/**
* Managing class for rebuilding the router table.
*/
class RouteBuilder implements RouteBuilderInterface {
class RouteBuilder implements RouteBuilderInterface, DestructableInterface {
/**
* The dumper to which we should send collected routes.
......@@ -57,13 +58,6 @@ class RouteBuilder implements RouteBuilderInterface {
*/
protected $moduleHandler;
/**
* The route builder indicator.
*
* @var \Drupal\Core\Routing\RouteBuilderIndicatorInterface
*/
protected $routeBuilderIndicator;
/**
* The controller resolver.
*
......@@ -79,12 +73,19 @@ class RouteBuilder implements RouteBuilderInterface {
protected $routeCollection;
/**
* Flag that indiciates if we are currently rebuilding the routes.
* Flag that indicates if we are currently rebuilding the routes.
*
* @var bool
*/
protected $building = FALSE;
/**
* Flag that indicates if we should rebuild at the end of the request.
*
* @var bool
*/
protected $rebuildNeeded = FALSE;
/**
* The check provider.
*
......@@ -107,19 +108,23 @@ class RouteBuilder implements RouteBuilderInterface {
* The controller resolver.
* @param \Drupal\Core\Access\CheckProviderInterface $check_provider
* The check provider.
* @param \Drupal\Core\Routing\RouteBuilderIndicatorInterface $route_build_indicator
* The route build indicator.
*/
public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, CheckProviderInterface $check_provider, RouteBuilderIndicatorInterface $route_build_indicator = NULL) {
public function __construct(MatcherDumperInterface $dumper, LockBackendInterface $lock, EventDispatcherInterface $dispatcher, ModuleHandlerInterface $module_handler, ControllerResolverInterface $controller_resolver, CheckProviderInterface $check_provider) {
$this->dumper = $dumper;
$this->lock = $lock;
$this->dispatcher = $dispatcher;
$this->moduleHandler = $module_handler;
$this->controllerResolver = $controller_resolver;
$this->routeBuilderIndicator = $route_build_indicator;
$this->checkProvider = $check_provider;
}
/**
* {@inheritdoc}
*/
public function setRebuildNeeded() {
$this->rebuildNeeded = TRUE;
}
/**
* {@inheritdoc}
*/
......@@ -139,7 +144,6 @@ public function rebuild() {
$this->building = TRUE;
$collection = new RouteCollection();
$this->routeCollection = $collection;
foreach ($this->getRouteDefinitions() as $routes) {
// The top-level 'routes_callback' is a list of methods in controller
// syntax, see \Drupal\Core\Controller\ControllerResolver. These methods
......@@ -176,7 +180,6 @@ public function rebuild() {
$route = new Route($route_info['path'], $route_info['defaults'], $route_info['requirements'], $route_info['options']);
$collection->add($name, $route);
}
}
// DYNAMIC is supposed to be used to add new routes based upon all the
......@@ -193,12 +196,11 @@ public function rebuild() {
$this->dumper->addRoutes($collection);
$this->dumper->dump();
$this->routeBuilderIndicator->setRebuildDone();
$this->lock->release('router_rebuild');
$this->dispatcher->dispatch(RoutingEvents::FINISHED, new Event());
$this->building = FALSE;
$this->routeCollection = NULL;
$this->rebuildNeeded = FALSE;
return TRUE;
}
......@@ -207,7 +209,7 @@ public function rebuild() {
* {@inheritdoc}
*/
public function rebuildIfNeeded() {
if ($this->routeBuilderIndicator->isRebuildNeeded()) {
if ($this->rebuildNeeded) {
return $this->rebuild();
}
return FALSE;
......@@ -216,8 +218,11 @@ public function rebuildIfNeeded() {
/**
* {@inheritdoc}
*/
public function setRebuildNeeded() {
$this->routeBuilderIndicator->setRebuildNeeded();
public function destruct() {
// Rebuild routes only once at the end of the request lifecycle to not
// trigger multiple rebuilds and also make the page more responsive for the
// user.
$this->rebuildIfNeeded();
}
/**
......
<?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();
}
......@@ -39,13 +39,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
*/
protected $tableName;
/**
* The route builder.
*
* @var \Drupal\Core\Routing\RouteBuilderInterface
*/
protected $routeBuilder;
/**
* The state.
*
......@@ -72,8 +65,6 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
*
* @param \Drupal\Core\Database\Connection $connection
* A database connection object.
* @param \Drupal\Core\Routing\RouteBuilderInterface $route_builder
* The route builder.
* @param \Drupal\Core\State\StateInterface $state
* The state.
* @param \Drupal\Core\Path\CurrentPathStack $current_path
......@@ -81,9 +72,8 @@ class RouteProvider implements RouteProviderInterface, PagedRouteProviderInterfa
* @param string $table
* The table in the database to use for matching.
*/
public function __construct(Connection $connection, RouteBuilderInterface $route_builder, StateInterface $state, CurrentPathStack $current_path, $table = 'router') {
public function __construct(Connection $connection, StateInterface $state, CurrentPathStack $current_path, $table = 'router') {
$this->connection = $connection;
$this->routeBuilder = $route_builder;
$this->state = $state;
$this->tableName = $table;
$this->currentPath = $current_path;
......@@ -117,14 +107,7 @@ public function __construct(Connection $connection, RouteBuilderInterface $route
public function getRouteCollectionForRequest(Request $request) {
$path = $this->currentPath->getPath($request);
$collection = $this->getRoutesByPath(rtrim($path, '/'));
// Try rebuilding the router if it is necessary.
if (!$collection->count() && $this->routeBuilder->rebuildIfNeeded()) {
$collection = $this->getRoutesByPath($path);
}
return $collection;
return $this->getRoutesByPath(rtrim($path, '/'));
}
/**
......@@ -170,8 +153,6 @@ public function getRoutesByNames($names) {
throw new \InvalidArgumentException('You must specify the route names to load');
}
$this->routeBuilder->rebuildIfNeeded();
$routes_to_load = array_diff($names, array_keys($this->routes));
if ($routes_to_load) {
$result = $this->connection->query('SELECT name, route FROM {' . $this->connection->escapeTable($this->tableName) . '} WHERE name IN ( :names[] )', array(':names[]' => $routes_to_load));
......@@ -257,7 +238,6 @@ public function getCandidateOutlines(array $parts) {
*/
public function getRoutesByPattern($pattern) {
$path = RouteCompiler::getPatternOutline($pattern);
$this->routeBuilder->rebuildIfNeeded();
return $this->getRoutesByPath($path);
}
......
......@@ -30,6 +30,7 @@ class BookUninstallTest extends KernelTestBase {
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('user');
$this->installEntitySchema('node');
$this->installSchema('book', array('book'));
......
......@@ -20,10 +20,11 @@ class BreakpointDiscoveryTest extends KernelTestBase {
*
* @var array
*/
public static $modules = array('breakpoint', 'breakpoint_module_test');
public static $modules = array('system', 'breakpoint', 'breakpoint_module_test');
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
\Drupal::service('theme_handler')->install(array('breakpoint_theme_test'));
}
......
......@@ -44,6 +44,7 @@ protected function setUp() {
// Install the Filter module.
$this->installSchema('system', 'url_alias');
$this->installSchema('system', 'router');
// Create text format, associate CKEditor.
$filtered_html_format = entity_create('filter_format', array(
......
......@@ -29,6 +29,7 @@ class CommentStringIdEntitiesTest extends KernelTestBase {
'field_ui',
'entity',
'entity_test',
'system',
'text',
);
......@@ -36,6 +37,7 @@ protected function setUp() {
parent::setUp();
$this->installEntitySchema('comment');
$this->installSchema('comment', array('comment_entity_statistics'));
$this->installSchema('system', array('router'));
// Create the comment body field storage.
$this->installConfig(array('field'));
}
......
......@@ -39,6 +39,11 @@ class ConfigCRUDTest extends KernelTestBase {
*/
public static $modules = array('system');
protected function setUp() {
parent::setUp();
$this->installSchema('system', 'router');
}
/**
* Tests CRUD operations.
*/
......
......@@ -45,6 +45,7 @@ class DefaultConfigTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', 'router');
\Drupal::service('theme_handler')->install($this->themes);
}
......
......@@ -295,7 +295,7 @@ function content_translation_form_language_content_settings_submit(array $form,
// Ensure entity and menu router information are correctly rebuilt.
\Drupal::entityManager()->clearCachedDefinitions();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
// If an entity type is not translatable all its bundles and fields must be
// marked as non-translatable. Similarly, if a bundle is made non-translatable
......
......@@ -477,7 +477,7 @@ function content_translation_language_configuration_element_submit(array $form,
if (\Drupal::service('content_translation.manager')->isEnabled($context['entity_type'], $context['bundle']) != $enabled) {
\Drupal::service('content_translation.manager')->setEnabled($context['entity_type'], $context['bundle'], $enabled);
\Drupal::entityManager()->clearCachedDefinitions();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
}
......
......@@ -20,7 +20,6 @@ class FieldAttachOtherTest extends FieldUnitTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->container->get('router.builder')->rebuild();
$this->installEntitySchema('entity_test_rev');
$this->createFieldWithStorage();
......
......@@ -29,7 +29,6 @@ protected function setUp() {
// Module uninstall requires the router and users_data tables.
// @see drupal_flush_all_caches()
// @see user_modules_uninstalled()
$this->installSchema('system', array('router'));
$this->installSchema('user', array('users_data'));
}
......
......@@ -51,6 +51,7 @@ protected function setUp() {
$this->installEntitySchema('entity_test');
$this->installEntitySchema('user');
$this->installSchema('system', array('sequences'));
$this->installSchema('system', array('router'));
// Set default storage backend and configure the theme system.
$this->installConfig(array('field', 'system'));
......
......@@ -80,7 +80,7 @@ function field_ui_entity_type_build(array &$entity_types) {
function field_ui_entity_bundle_create($entity_type, $bundle) {
// When a new bundle is created, the menu needs to be rebuilt to add our
// menu item tabs.
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
......@@ -89,7 +89,7 @@ function field_ui_entity_bundle_create($entity_type, $bundle) {
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
// menu item tabs.
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
......@@ -169,28 +169,28 @@ function field_ui_form_node_type_form_submit($form, FormStateInterface $form_sta
* Implements hook_entity_view_mode_presave().
*/
function field_ui_entity_view_mode_presave(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_form_mode_presave().
*/
function field_ui_entity_form_mode_presave(EntityFormModeInterface $form_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_view_mode_delete().
*/
function field_ui_entity_view_mode_delete(EntityViewModeInterface $view_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
* Implements hook_entity_form_mode_delete().
*/
function field_ui_entity_form_mode_delete(EntityFormModeInterface $form_mode) {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
......
......@@ -26,6 +26,7 @@ class EntityDisplayTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('node');
$this->installConfig(array('field'));
}
......
......@@ -80,6 +80,8 @@ public function testFieldUIRoutes() {
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
$this->container->get('router.builder')->rebuildIfNeeded();
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/display', $edit, t('Save'));
$this->assertLink('Test');
......@@ -91,6 +93,8 @@ public function testFieldUIRoutes() {
'label' => 'Test',
'targetEntityType' => 'user',
))->save();
$this->container->get('router.builder')->rebuildIfNeeded();
$edit = array('display_modes_custom[test]' => TRUE);
$this->drupalPostForm('admin/config/people/accounts/form-display', $edit, t('Save'));
$this->assertLink('Test');
......
......@@ -28,6 +28,7 @@ class FilterAPITest extends EntityUnitTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installConfig(array('system', 'filter'));
}
......
......@@ -28,7 +28,6 @@ class LinkItemTest extends FieldUnitTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', ['router']);
// Create a link field for validation.
entity_create('field_storage_config', array(
......
......@@ -21,5 +21,5 @@ function menu_ui_install() {
* Implements hook_uninstall().
*/
function menu_ui_uninstall() {
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
......@@ -880,7 +880,7 @@ function node_form_system_themes_admin_form_submit($form, FormStateInterface $fo
\Drupal::configFactory()->getEditable('node.settings')
->set('use_admin_theme', $form_state->getValue('use_admin_theme'))
->save();
\Drupal::service('router.builder_indicator')->setRebuildNeeded();
\Drupal::service('router.builder')->setRebuildNeeded();
}
/**
......
......@@ -30,6 +30,7 @@ class NodeImportCreateTest extends KernelTestBase {
*/
protected function setUp() {
parent::setUp();
$this->installSchema('system', array('router'));
$this->installEntitySchema('user');
// Set default storage backend.
......
......@@ -32,6 +32,7 @@ class NodeBodyFieldStorageTest extends KernelTestBase {
protected function setUp() {
parent::setUp();
$this->installSchema('system', 'sequences');
$this->installSchema('system', array('router'));
// Necessary for module uninstall.
$this->installSchema('user', 'users_data');
$this->installEntitySchema('user');
......
......@@ -90,6 +90,7 @@ protected function setUp() {
}
$node->save();
}