Commit e79723c3 authored by catch's avatar catch
Browse files

Issue #3074585 by mikelutz, alexpott, Berdir, Mile23, heddn, effulgentsia, Wim...

Issue #3074585 by mikelutz, alexpott, Berdir, Mile23, heddn, effulgentsia, Wim Leers: [Symfony 5] Replace app.root and site.path string services with container parameters
parent 951ca46b
parameters: parameters:
# The app.root and site.path parameters are dynamically set by
# \Drupal\Core\DrupalKernel::initializeContainer(). They are listed here to
# allow IDEs to autocomplete them when writing new service YAML files.
app.root: ''
site.path: ''
session.storage.options: session.storage.options:
gc_probability: 1 gc_probability: 1
gc_divisor: 100 gc_divisor: 100
...@@ -201,7 +206,7 @@ services: ...@@ -201,7 +206,7 @@ services:
arguments: ['@database', '@cache_tags.invalidator.checksum', '@settings'] arguments: ['@database', '@cache_tags.invalidator.checksum', '@settings']
cache.backend.apcu: cache.backend.apcu:
class: Drupal\Core\Cache\ApcuBackendFactory class: Drupal\Core\Cache\ApcuBackendFactory
arguments: ['@app.root', '@site.path', '@cache_tags.invalidator.checksum'] arguments: ['%app.root%', '%site.path%', '@cache_tags.invalidator.checksum']
cache.backend.php: cache.backend.php:
class: Drupal\Core\Cache\PhpBackendFactory class: Drupal\Core\Cache\PhpBackendFactory
arguments: ['@cache_tags.invalidator.checksum'] arguments: ['@cache_tags.invalidator.checksum']
...@@ -395,7 +400,7 @@ services: ...@@ -395,7 +400,7 @@ services:
class: Drupal\Core\Form\FormErrorHandler class: Drupal\Core\Form\FormErrorHandler
form_cache: form_cache:
class: Drupal\Core\Form\FormCache class: Drupal\Core\Form\FormCache
arguments: ['@app.root', '@keyvalue.expirable', '@module_handler', '@current_user', '@csrf_token', '@logger.channel.form', '@request_stack', '@page_cache_request_policy'] arguments: ['%app.root%', '@keyvalue.expirable', '@module_handler', '@current_user', '@csrf_token', '@logger.channel.form', '@request_stack', '@page_cache_request_policy']
public: false # Private to form_builder public: false # Private to form_builder
keyvalue: keyvalue:
class: Drupal\Core\KeyValueStore\KeyValueFactory class: Drupal\Core\KeyValueStore\KeyValueFactory
...@@ -484,7 +489,7 @@ services: ...@@ -484,7 +489,7 @@ services:
arguments: ['@http_handler_stack'] arguments: ['@http_handler_stack']
plugin.manager.link_relation_type: plugin.manager.link_relation_type:
class: \Drupal\Core\Http\LinkRelationTypeManager class: \Drupal\Core\Http\LinkRelationTypeManager
arguments: ['@app.root', '@module_handler', '@cache.discovery'] arguments: ['%app.root%', '@module_handler', '@cache.discovery']
theme.negotiator: theme.negotiator:
class: Drupal\Core\Theme\ThemeNegotiator class: Drupal\Core\Theme\ThemeNegotiator
arguments: ['@access_check.theme', '@class_resolver'] arguments: ['@access_check.theme', '@class_resolver']
...@@ -512,25 +517,25 @@ services: ...@@ -512,25 +517,25 @@ services:
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler'] arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
module_handler: module_handler:
class: Drupal\Core\Extension\ModuleHandler class: Drupal\Core\Extension\ModuleHandler
arguments: ['@app.root', '%container.modules%', '@cache.bootstrap'] arguments: ['%app.root%', '%container.modules%', '@cache.bootstrap']
module_installer: module_installer:
class: Drupal\Core\Extension\ModuleInstaller class: Drupal\Core\Extension\ModuleInstaller
tags: tags:
- { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator } - { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator }
arguments: ['@app.root', '@module_handler', '@kernel'] arguments: ['%app.root%', '@module_handler', '@kernel']
lazy: true lazy: true
extension.list.module: extension.list.module:
class: Drupal\Core\Extension\ModuleExtensionList class: Drupal\Core\Extension\ModuleExtensionList
arguments: ['@app.root', 'module', '@cache.default', '@info_parser', '@module_handler', '@state', '@config.factory', '@extension.list.profile', '%install_profile%', '%container.modules%'] arguments: ['%app.root%', 'module', '@cache.default', '@info_parser', '@module_handler', '@state', '@config.factory', '@extension.list.profile', '%install_profile%', '%container.modules%']
extension.list.profile: extension.list.profile:
class: Drupal\Core\Extension\ProfileExtensionList class: Drupal\Core\Extension\ProfileExtensionList
arguments: ['@app.root', 'profile', '@cache.default', '@info_parser', '@module_handler', '@state', '%install_profile%'] arguments: ['%app.root%', 'profile', '@cache.default', '@info_parser', '@module_handler', '@state', '%install_profile%']
extension.list.theme: extension.list.theme:
class: Drupal\Core\Extension\ThemeExtensionList class: Drupal\Core\Extension\ThemeExtensionList
arguments: ['@app.root', 'theme', '@cache.default', '@info_parser', '@module_handler', '@state', '@config.factory', '@extension.list.theme_engine', '%install_profile%'] arguments: ['%app.root%', 'theme', '@cache.default', '@info_parser', '@module_handler', '@state', '@config.factory', '@extension.list.theme_engine', '%install_profile%']
extension.list.theme_engine: extension.list.theme_engine:
class: Drupal\Core\Extension\ThemeEngineExtensionList class: Drupal\Core\Extension\ThemeEngineExtensionList
arguments: ['@app.root', 'theme_engine', '@cache.default', '@info_parser', '@module_handler', '@state', '%install_profile%'] arguments: ['%app.root%', 'theme_engine', '@cache.default', '@info_parser', '@module_handler', '@state', '%install_profile%']
content_uninstall_validator: content_uninstall_validator:
class: Drupal\Core\Entity\ContentUninstallValidator class: Drupal\Core\Entity\ContentUninstallValidator
tags: tags:
...@@ -545,7 +550,7 @@ services: ...@@ -545,7 +550,7 @@ services:
lazy: true lazy: true
theme_handler: theme_handler:
class: Drupal\Core\Extension\ThemeHandler class: Drupal\Core\Extension\ThemeHandler
arguments: ['@app.root', '@config.factory', '@extension.list.theme'] arguments: ['%app.root%', '@config.factory', '@extension.list.theme']
theme_installer: theme_installer:
class: Drupal\Core\Extension\ThemeInstaller class: Drupal\Core\Extension\ThemeInstaller
arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state'] arguments: ['@theme_handler', '@config.factory', '@config.installer', '@module_handler', '@config.manager', '@asset.css.collection_optimizer', '@router.builder', '@logger.channel.default', '@state']
...@@ -696,23 +701,27 @@ services: ...@@ -696,23 +701,27 @@ services:
class: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher class: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
arguments: ['@service_container'] arguments: ['@service_container']
app.root: app.root:
class: SplString class: \SplString
factory: ['@app.root.factory', 'get'] factory: ['@app.root.factory', 'get']
deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use the app.root parameter instead. See https://www.drupal.org/node/3080612
tags: tags:
- { name: parameter_service } - { name: parameter_service }
app.root.factory: app.root.factory:
class: Drupal\Core\AppRootFactory class: Drupal\Core\AppRootFactory
arguments: ['@kernel'] arguments: ['@kernel']
public: false public: false
deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use the app.root parameter instead. See https://www.drupal.org/node/3080612
site.path: site.path:
class: SplString class: \SplString
factory: ['@site.path.factory', 'get'] factory: ['@site.path.factory', 'get']
deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use the site.path parameter instead. See https://www.drupal.org/node/3080612
tags: tags:
- { name: parameter_service } - { name: parameter_service }
site.path.factory: site.path.factory:
class: Drupal\Core\SitePathFactory class: Drupal\Core\SitePathFactory
arguments: ['@kernel'] arguments: ['@kernel']
public: false public: false
deprecated: The "%service_id%" service is deprecated in drupal:9.0.0 and is removed from drupal:10.0.0. Use the site.path parameter instead. See https://www.drupal.org/node/3080612
controller_resolver: controller_resolver:
class: Drupal\Core\Controller\ControllerResolver class: Drupal\Core\Controller\ControllerResolver
arguments: ['@psr7.http_message_factory', '@class_resolver'] arguments: ['@psr7.http_message_factory', '@class_resolver']
...@@ -1462,15 +1471,15 @@ services: ...@@ -1462,15 +1471,15 @@ services:
shared: false shared: false
theme.manager: theme.manager:
class: Drupal\Core\Theme\ThemeManager class: Drupal\Core\Theme\ThemeManager
arguments: ['@app.root', '@theme.negotiator', '@theme.initialization', '@module_handler'] arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler']
calls: calls:
- [setThemeRegistry, ['@theme.registry']] - [setThemeRegistry, ['@theme.registry']]
theme.initialization: theme.initialization:
class: Drupal\Core\Theme\ThemeInitialization class: Drupal\Core\Theme\ThemeInitialization
arguments: ['@app.root', '@theme_handler', '@cache.bootstrap', '@module_handler'] arguments: ['%app.root%', '@theme_handler', '@cache.bootstrap', '@module_handler']
theme.registry: theme.registry:
class: Drupal\Core\Theme\Registry class: Drupal\Core\Theme\Registry
arguments: ['@app.root', '@cache.default', '@lock', '@module_handler', '@theme_handler', '@theme.initialization', null, '@cache.bootstrap'] arguments: ['%app.root%', '@cache.default', '@lock', '@module_handler', '@theme_handler', '@theme.initialization', null, '@cache.bootstrap']
tags: tags:
- { name: needs_destruction } - { name: needs_destruction }
calls: calls:
...@@ -1567,10 +1576,10 @@ services: ...@@ -1567,10 +1576,10 @@ services:
- { name: needs_destruction } - { name: needs_destruction }
library.discovery.parser: library.discovery.parser:
class: Drupal\Core\Asset\LibraryDiscoveryParser class: Drupal\Core\Asset\LibraryDiscoveryParser
arguments: ['@app.root', '@module_handler', '@theme.manager', '@stream_wrapper_manager', '@library.libraries_directory_file_finder'] arguments: ['%app.root%', '@module_handler', '@theme.manager', '@stream_wrapper_manager', '@library.libraries_directory_file_finder']
library.libraries_directory_file_finder: library.libraries_directory_file_finder:
class: Drupal\Core\Asset\LibrariesDirectoryFileFinder class: Drupal\Core\Asset\LibrariesDirectoryFileFinder
arguments: ['@app.root', '@site.path', '@extension.list.profile', '%install_profile%'] arguments: ['%app.root%', '%site.path%', '@extension.list.profile', '%install_profile%']
library.dependency_resolver: library.dependency_resolver:
class: Drupal\Core\Asset\LibraryDependencyResolver class: Drupal\Core\Asset\LibraryDependencyResolver
arguments: ['@library.discovery'] arguments: ['@library.discovery']
...@@ -1579,10 +1588,10 @@ services: ...@@ -1579,10 +1588,10 @@ services:
arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data'] arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data']
info_parser: info_parser:
class: Drupal\Core\Extension\InfoParser class: Drupal\Core\Extension\InfoParser
arguments: ['@app.root'] arguments: ['%app.root%']
twig: twig:
class: Drupal\Core\Template\TwigEnvironment class: Drupal\Core\Template\TwigEnvironment
arguments: ['@app.root', '@cache.default', '%twig_extension_hash%', '@state', '@twig.loader', '%twig.config%'] arguments: ['%app.root%', '@cache.default', '%twig_extension_hash%', '@state', '@twig.loader', '%twig.config%']
tags: tags:
- { name: service_collector, tag: 'twig.extension', call: addExtension } - { name: service_collector, tag: 'twig.extension', call: addExtension }
twig.extension: twig.extension:
...@@ -1603,7 +1612,7 @@ services: ...@@ -1603,7 +1612,7 @@ services:
- { name: service_collector, tag: twig.loader, call: addLoader, required: TRUE } - { name: service_collector, tag: twig.loader, call: addLoader, required: TRUE }
twig.loader.filesystem: twig.loader.filesystem:
class: Drupal\Core\Template\Loader\FilesystemLoader class: Drupal\Core\Template\Loader\FilesystemLoader
# We use '.' instead of '@app.root' as the path for non-namespaced template # We use '.' instead of '%app.root%' as the path for non-namespaced template
# files so that they match the relative paths of templates loaded via the # files so that they match the relative paths of templates loaded via the
# theme registry or via Twig namespaces. # theme registry or via Twig namespaces.
arguments: ['.', '@module_handler', '@theme_handler'] arguments: ['.', '@module_handler', '@theme_handler']
......
...@@ -220,7 +220,7 @@ function _drupal_log_error($error, $fatal = FALSE) { ...@@ -220,7 +220,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
// Attempt to reduce verbosity by removing DRUPAL_ROOT from the file path // Attempt to reduce verbosity by removing DRUPAL_ROOT from the file path
// in the message. This does not happen for (false) security. // in the message. This does not happen for (false) security.
if (\Drupal::hasService('app.root')) { if (\Drupal::hasService('kernel')) {
$root_length = strlen(\Drupal::root()); $root_length = strlen(\Drupal::root());
if (substr($error['%file'], 0, $root_length) == \Drupal::root()) { if (substr($error['%file'], 0, $root_length) == \Drupal::root()) {
$error['%file'] = substr($error['%file'], $root_length + 1); $error['%file'] = substr($error['%file'], $root_length + 1);
......
...@@ -447,7 +447,7 @@ function install_begin_request($class_loader, &$install_state) { ...@@ -447,7 +447,7 @@ function install_begin_request($class_loader, &$install_state) {
->addTranslator($container->get('string_translator.file_translation')); ->addTranslator($container->get('string_translator.file_translation'));
// Add list of all available profiles to the installation state. // Add list of all available profiles to the installation state.
$listing = new ExtensionDiscovery($container->get('app.root')); $listing = new ExtensionDiscovery($container->getParameter('app.root'));
$listing->setProfileDirectories([]); $listing->setProfileDirectories([]);
$install_state['profiles'] += $listing->scan('profile'); $install_state['profiles'] += $listing->scan('profile');
...@@ -1896,7 +1896,7 @@ function install_check_translations($langcode, $server_pattern) { ...@@ -1896,7 +1896,7 @@ function install_check_translations($langcode, $server_pattern) {
$readable = FALSE; $readable = FALSE;
$writable = FALSE; $writable = FALSE;
// @todo: Make this configurable. // @todo: Make this configurable.
$site_path = \Drupal::service('site.path'); $site_path = \Drupal::getContainer()->getParameter('site.path');
$files_directory = $site_path . '/files'; $files_directory = $site_path . '/files';
$translations_directory = $site_path . '/files/translations'; $translations_directory = $site_path . '/files/translations';
$translations_directory_exists = FALSE; $translations_directory_exists = FALSE;
...@@ -2075,7 +2075,7 @@ function install_check_requirements($install_state) { ...@@ -2075,7 +2075,7 @@ function install_check_requirements($install_state) {
foreach ($default_files as $default_file_info) { foreach ($default_files as $default_file_info) {
$readable = FALSE; $readable = FALSE;
$writable = FALSE; $writable = FALSE;
$site_path = './' . \Drupal::service('site.path'); $site_path = './' . \Drupal::getContainer()->getParameter('site.path');
$file = $site_path . "/{$default_file_info['file']}"; $file = $site_path . "/{$default_file_info['file']}";
$default_file = "./sites/default/{$default_file_info['file_default']}"; $default_file = "./sites/default/{$default_file_info['file_default']}";
$exists = FALSE; $exists = FALSE;
......
...@@ -217,7 +217,7 @@ function drupal_get_database_types() { ...@@ -217,7 +217,7 @@ function drupal_get_database_types() {
*/ */
function drupal_rewrite_settings($settings = [], $settings_file = NULL) { function drupal_rewrite_settings($settings = [], $settings_file = NULL) {
if (!isset($settings_file)) { if (!isset($settings_file)) {
$settings_file = \Drupal::service('site.path') . '/settings.php'; $settings_file = \Drupal::getContainer()->getParameter('site.path') . '/settings.php';
} }
// Build list of setting names and insert the values into the global namespace. // Build list of setting names and insert the values into the global namespace.
$variable_names = []; $variable_names = [];
......
...@@ -176,7 +176,7 @@ public static function hasService($id) { ...@@ -176,7 +176,7 @@ public static function hasService($id) {
* @return string * @return string
*/ */
public static function root() { public static function root() {
return static::getContainer()->get('app.root'); return static::getContainer()->getParameter('app.root');
} }
/** /**
......
...@@ -28,9 +28,10 @@ public function __construct(DrupalKernelInterface $drupal_kernel) { ...@@ -28,9 +28,10 @@ public function __construct(DrupalKernelInterface $drupal_kernel) {
* Gets the app root. * Gets the app root.
* *
* @return string * @return string
* The app root.
*/ */
public function get() { public function get() {
return $this->drupalKernel->getAppRoot(); return $this->drupalKernel->getContainer()->getParameter('app.root');
} }
} }
...@@ -43,7 +43,7 @@ public function getFormOptions(array $database) { ...@@ -43,7 +43,7 @@ public function getFormOptions(array $database) {
// Make the text more accurate for SQLite. // Make the text more accurate for SQLite.
$form['database']['#title'] = t('Database file'); $form['database']['#title'] = t('Database file');
$form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', ['@drupal' => drupal_install_profile_distribution_name()]); $form['database']['#description'] = t('The absolute path to the file where @drupal data will be stored. This must be writable by the web server and should exist outside of the web root.', ['@drupal' => drupal_install_profile_distribution_name()]);
$default_database = \Drupal::service('site.path') . '/files/.ht.sqlite'; $default_database = \Drupal::getContainer()->getParameter('site.path') . '/files/.ht.sqlite';
$form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database']; $form['database']['#default_value'] = empty($database['database']) ? $default_database : $database['database'];
return $form; return $form;
} }
......
...@@ -896,6 +896,10 @@ protected function initializeContainer() { ...@@ -896,6 +896,10 @@ protected function initializeContainer() {
// Only create a new class if we have a container definition. // Only create a new class if we have a container definition.
if (isset($container_definition)) { if (isset($container_definition)) {
// Drupal provides two dynamic parameters to access specific paths that
// are determined from the request.
$container_definition['parameters']['app.root'] = $this->getAppRoot();
$container_definition['parameters']['site.path'] = $this->getSitePath();
$class = Settings::get('container_base_class', '\Drupal\Core\DependencyInjection\Container'); $class = Settings::get('container_base_class', '\Drupal\Core\DependencyInjection\Container');
$container = new $class($container_definition); $container = new $class($container_definition);
} }
...@@ -1271,6 +1275,9 @@ protected function compileContainer() { ...@@ -1271,6 +1275,9 @@ protected function compileContainer() {
} }
$container->setParameter('persist_ids', $persist_ids); $container->setParameter('persist_ids', $persist_ids);
$container->setParameter('app.root', $this->getAppRoot());
$container->setParameter('site.path', $this->getSitePath());
$container->compile(); $container->compile();
return $container; return $container;
} }
......
...@@ -182,8 +182,14 @@ public function __sleep() { ...@@ -182,8 +182,14 @@ public function __sleep() {
* Magic method implementation to unserialize the extension object. * Magic method implementation to unserialize the extension object.
*/ */
public function __wakeup() { public function __wakeup() {
// Get the app root from the container. // Get the app root from the container. While compiling the container we
$this->root = \Drupal::hasService('app.root') ? \Drupal::root() : DRUPAL_ROOT; // have to discover all the extension service files in
// \Drupal\Core\DrupalKernel::initializeServiceProviders(). This results in
// creating extension objects before the container has the kernel.
// Specifically, this occurs during the call to
// \Drupal\Core\Extension\ExtensionDiscovery::scanDirectory().
$container = \Drupal::hasContainer() ? \Drupal::getContainer() : FALSE;
$this->root = $container && $container->hasParameter('app.root') ? $container->getParameter('app.root') : DRUPAL_ROOT;
} }
} }
...@@ -103,7 +103,7 @@ class ExtensionDiscovery { ...@@ -103,7 +103,7 @@ class ExtensionDiscovery {
* @param string $site_path * @param string $site_path
* The path to the site. * The path to the site.
*/ */
public function __construct($root, $use_file_cache = TRUE, $profile_directories = NULL, $site_path = NULL) { public function __construct(string $root, $use_file_cache = TRUE, array $profile_directories = NULL, string $site_path = NULL) {
$this->root = $root; $this->root = $root;
$this->fileCache = $use_file_cache ? FileCacheFactory::get('extension_discovery') : NULL; $this->fileCache = $use_file_cache ? FileCacheFactory::get('extension_discovery') : NULL;
$this->profileDirectories = $profile_directories; $this->profileDirectories = $profile_directories;
...@@ -184,7 +184,7 @@ public function scan($type, $include_tests = NULL) { ...@@ -184,7 +184,7 @@ public function scan($type, $include_tests = NULL) {
// at install time. Therefore Kernel service is not always available, but is // at install time. Therefore Kernel service is not always available, but is
// preferred. // preferred.
if (\Drupal::hasService('kernel')) { if (\Drupal::hasService('kernel')) {
$searchdirs[static::ORIGIN_SITE] = \Drupal::service('site.path'); $searchdirs[static::ORIGIN_SITE] = \Drupal::getContainer()->getParameter('site.path');
} }
else { else {
$searchdirs[static::ORIGIN_SITE] = $this->sitePath ?: DrupalKernel::findSitePath(Request::createFromGlobals()); $searchdirs[static::ORIGIN_SITE] = $this->sitePath ?: DrupalKernel::findSitePath(Request::createFromGlobals());
......
...@@ -33,7 +33,7 @@ public function __construct(string $app_root = NULL) { ...@@ -33,7 +33,7 @@ public function __construct(string $app_root = NULL) {
if ($app_root === NULL) { if ($app_root === NULL) {
// @todo https://www.drupal.org/project/drupal/issues/3087975 Require // @todo https://www.drupal.org/project/drupal/issues/3087975 Require
// $app_root argument. // $app_root argument.
$app_root = \Drupal::hasService('app.root') ? (string) \Drupal::service('app.root') : DRUPAL_ROOT; $app_root = \Drupal::hasService('kernel') ? \Drupal::root() : DRUPAL_ROOT;
} }
$this->root = $app_root; $this->root = $app_root;
} }
......
...@@ -36,7 +36,7 @@ public function __construct($root) { ...@@ -36,7 +36,7 @@ public function __construct($root) {
* {@inheritdoc} * {@inheritdoc}
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static($container->get('app.root')); return new static($container->getParameter('app.root'));
} }
/** /**
......
...@@ -91,8 +91,8 @@ public function __construct($root, $site_path, UserStorageInterface $user_storag ...@@ -91,8 +91,8 @@ public function __construct($root, $site_path, UserStorageInterface $user_storag
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('app.root'), $container->getParameter('app.root'),
$container->get('site.path'), $container->getParameter('site.path'),
$container->get('entity_type.manager')->getStorage('user'), $container->get('entity_type.manager')->getStorage('user'),
$container->get('state'), $container->get('state'),
$container->get('module_installer'), $container->get('module_installer'),
......
...@@ -48,7 +48,7 @@ public function __construct($site_path, RendererInterface $renderer) { ...@@ -48,7 +48,7 @@ public function __construct($site_path, RendererInterface $renderer) {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
$container->get('site.path'), $container->getParameter('site.path'),
$container->get('renderer') $container->get('renderer')
); );
} }
...@@ -264,7 +264,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { ...@@ -264,7 +264,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* The path to the generated config sync directory. * The path to the generated config sync directory.
*/ */
protected function createRandomConfigDirectory() { protected function createRandomConfigDirectory() {
$config_sync_directory = \Drupal::service('site.path') . '/files/config_' . Crypt::randomBytesBase64(55) . '/sync'; $config_sync_directory = $this->sitePath . '/files/config_' . Crypt::randomBytesBase64(55) . '/sync';
// This should never fail, it is created here inside the public files // This should never fail, it is created here inside the public files
// directory, which has already been verified to be writable itself. // directory, which has already been verified to be writable itself.
if (\Drupal::service('file_system')->prepareDirectory($config_sync_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) { if (\Drupal::service('file_system')->prepareDirectory($config_sync_directory, FileSystemInterface::CREATE_DIRECTORY | FileSystemInterface::MODIFY_PERMISSIONS)) {
......
...@@ -31,7 +31,7 @@ public function __construct(DrupalKernelInterface $drupal_kernel) { ...@@ -31,7 +31,7 @@ public function __construct(DrupalKernelInterface $drupal_kernel) {
* The site path. * The site path.
*/ */
public function get() { public function get() {
return $this->drupalKernel->getSitePath(); return $this->drupalKernel->getContainer()->getParameter('site.path');
} }
} }
...@@ -86,7 +86,7 @@ public static function baseUrl() { ...@@ -86,7 +86,7 @@ public static function baseUrl() {
* *
* The site path is injectable from the site.path service: * The site path is injectable from the site.path service:
* @code * @code
* $base_path = PublicStream::basePath(\Drupal::service('site.path')); * $base_path = PublicStream::basePath(\Drupal::getContainer()->getParameter('site.path'));
* @endcode * @endcode
* *
* @param string $site_path * @param string $site_path
...@@ -104,7 +104,7 @@ public static function basePath($site_path = NULL) { ...@@ -104,7 +104,7 @@ public static function basePath($site_path = NULL) {
// Find the site path. Kernel service is not always available at this // Find the site path. Kernel service is not always available at this
// point, but is preferred, when available. // point, but is preferred, when available.
if (\Drupal::hasService('kernel')) { if (\Drupal::hasService('kernel')) {
$site_path = \Drupal::service('site.path'); $site_path = \Drupal::getContainer()->getParameter('site.path');
} }
else { else {
// If there is no kernel available yet, we call the static // If there is no kernel available yet, we call the static
......
...@@ -44,7 +44,7 @@ class PhpUnitTestRunner implements ContainerInjectionInterface { ...@@ -44,7 +44,7 @@ class PhpUnitTestRunner implements ContainerInjectionInterface {
*/ */
public static function create(ContainerInterface $container) { public static function create(ContainerInterface $container) {
return new static( return new static(
(string) $container->get('app.root'), (string) $container->getParameter('app.root'),
(string) $container->get('file_system')->realpath('public://simpletest') (string) $container->get('file_system')->realpath('public://simpletest')
); );
} }
......
...@@ -77,7 +77,7 @@ public function boot() { ...@@ -77,7 +77,7 @@ public function boot() {
$this->getContainer()->get('module_handler')->loadAll(); $this->getContainer()->get('module_handler')->loadAll();