function InstallerServiceProvider::register

Same name in other branches
  1. 9 core/lib/Drupal/Core/Installer/InstallerServiceProvider.php \Drupal\Core\Installer\InstallerServiceProvider::register()
  2. 10 core/lib/Drupal/Core/Installer/InstallerServiceProvider.php \Drupal\Core\Installer\InstallerServiceProvider::register()
  3. 11.x core/lib/Drupal/Core/Installer/InstallerServiceProvider.php \Drupal\Core\Installer\InstallerServiceProvider::register()

Overrides ServiceProviderInterface::register

File

core/lib/Drupal/Core/Installer/InstallerServiceProvider.php, line 22

Class

InstallerServiceProvider
Service provider for the early installer environment.

Namespace

Drupal\Core\Installer

Code

public function register(ContainerBuilder $container) {
    // Inject the special configuration storage for the installer.
    // This special implementation MUST NOT be used anywhere else than the early
    // installer environment.
    $container->register('config.storage', 'Drupal\\Core\\Config\\InstallStorage');
    // Replace services with in-memory implementations.
    $definition = $container->getDefinition('cache_factory');
    $definition->setClass('Drupal\\Core\\Cache\\MemoryBackendFactory');
    $definition->setArguments([]);
    $definition->setMethodCalls([]);
    $container->register('keyvalue', 'Drupal\\Core\\KeyValueStore\\KeyValueMemoryFactory');
    $container->register('keyvalue.expirable', 'Drupal\\Core\\KeyValueStore\\KeyValueNullExpirableFactory');
    // Replace services with no-op implementations.
    $container->register('lock', 'Drupal\\Core\\Lock\\NullLockBackend');
    $container->register('url_generator', 'Drupal\\Core\\Routing\\NullGenerator')
        ->addArgument(new Reference('request_stack'));
    $container->register('path_processor_manager', 'Drupal\\Core\\PathProcessor\\NullPathProcessorManager');
    $container->register('router.dumper', 'Drupal\\Core\\Routing\\NullMatcherDumper');
    // Remove the cache tags invalidator tag from the cache tags storage, so
    // that we don't call it when cache tags are invalidated very early in the
    // installer.
    $container->getDefinition('cache_tags.invalidator.checksum')
        ->clearTag('cache_tags_invalidator');
    // Replace the route builder with an empty implementation.
    // @todo Convert installer steps into routes; add an installer.routing.yml.
    $definition = $container->getDefinition('router.builder');
    $definition->setClass('Drupal\\Core\\Installer\\InstallerRouteBuilder')
        ->setLazy(FALSE);
    // Use a performance optimised module extension list.
    $container->getDefinition('extension.list.module')
        ->setClass('Drupal\\Core\\Installer\\InstallerModuleExtensionList');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.