function NormalInstallerServiceProvider::register
Same name in other branches
- 9 core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php \Drupal\Core\Installer\NormalInstallerServiceProvider::register()
- 8.9.x core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php \Drupal\Core\Installer\NormalInstallerServiceProvider::register()
- 11.x core/lib/Drupal/Core/Installer/NormalInstallerServiceProvider.php \Drupal\Core\Installer\NormalInstallerServiceProvider::register()
Overrides ServiceProviderInterface::register
1 call to NormalInstallerServiceProvider::register()
- InstallerServiceProvider::register in core/
lib/ Drupal/ Core/ Installer/ InstallerServiceProvider.php
1 method overrides NormalInstallerServiceProvider::register()
- InstallerServiceProvider::register in core/
lib/ Drupal/ Core/ Installer/ InstallerServiceProvider.php
File
-
core/
lib/ Drupal/ Core/ Installer/ NormalInstallerServiceProvider.php, line 36
Class
- NormalInstallerServiceProvider
- Service provider for the installer environment.
Namespace
Drupal\Core\InstallerCode
public function register(ContainerBuilder $container) {
// During the installer user 1 is a superuser.
$container->setDefinition(InstallerAccessPolicy::class, (new Definition())->addTag('access_policy')
->setPublic(FALSE));
// Replace cache services with in-memory implementations. The results in
// less queries to set caches which will only be cleared on the next module
// install.
$definition = $container->getDefinition('cache_factory');
$definition->setClass(MemoryBackendFactory::class);
$definition->setArguments([
new Time(),
]);
$definition->setMethodCalls([]);
// Replace lock service with no-op implementation as Drupal installation can
// only occur in a single thread and the site should not be publicly
// available.
$container->register('lock', NullLockBackend::class);
// Remove the cache tags invalidator tag from the cache tags storage, so
// that we don't call it when cache tags are invalidated in the installer.
$container->getDefinition('cache_tags.invalidator.checksum')
->clearTag('cache_tags_invalidator');
// Use performance-optimized extension lists.
$container->getDefinition('extension.list.module')
->setClass(InstallerModuleExtensionList::class);
$container->getDefinition('extension.list.theme')
->setClass(InstallerThemeExtensionList::class);
$container->getDefinition('extension.list.theme_engine')
->setClass(InstallerThemeEngineExtensionList::class);
// Don't register the lazy route provider in the super early installer.
if (static::class === NormalInstallerServiceProvider::class) {
$lazy_route_provider = $container->register('router.route_provider.installer');
$lazy_route_provider->setClass(InstallerRouteProviderLazyBuilder::class)
->setDecoratedService('router.route_provider')
->addArgument(new Reference('router.route_provider.installer.inner'))
->addArgument(new Reference('router.builder'))
->addTag('event_subscriber');
}
$pass_config = $container->getCompilerPassConfig();
$pass_config->setRemovingPasses(array_filter($pass_config->getRemovingPasses(), function ($pass) {
// Remove InlineServiceDefinitionsPass, RemoveUnusedDefinitionsPass,
// AnalyzeServiceReferencesPass and ReplaceAliasByActualDefinitionPass as
// these are not necessary during installation.
// @see \Symfony\Component\DependencyInjection\Compiler\PassConfig
return !($pass instanceof InlineServiceDefinitionsPass || $pass instanceof RemoveUnusedDefinitionsPass || $pass instanceof AnalyzeServiceReferencesPass || $pass instanceof ReplaceAliasByActualDefinitionPass);
}));
$pass_config->setAfterRemovingPasses(array_filter($pass_config->getAfterRemovingPasses(), function ($pass) {
// Remove ResolveHotPathPass as Drupal's container dumper does not support
// it.
// @see \Symfony\Component\DependencyInjection\Compiler\PassConfig
return !$pass instanceof ResolveHotPathPass;
}));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.