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:
# 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:
gc_probability: 1
gc_divisor: 100
......@@ -201,7 +206,7 @@ services:
arguments: ['@database', '@cache_tags.invalidator.checksum', '@settings']
cache.backend.apcu:
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:
class: Drupal\Core\Cache\PhpBackendFactory
arguments: ['@cache_tags.invalidator.checksum']
......@@ -395,7 +400,7 @@ services:
class: Drupal\Core\Form\FormErrorHandler
form_cache:
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
keyvalue:
class: Drupal\Core\KeyValueStore\KeyValueFactory
......@@ -484,7 +489,7 @@ services:
arguments: ['@http_handler_stack']
plugin.manager.link_relation_type:
class: \Drupal\Core\Http\LinkRelationTypeManager
arguments: ['@app.root', '@module_handler', '@cache.discovery']
arguments: ['%app.root%', '@module_handler', '@cache.discovery']
theme.negotiator:
class: Drupal\Core\Theme\ThemeNegotiator
arguments: ['@access_check.theme', '@class_resolver']
......@@ -512,25 +517,25 @@ services:
arguments: ['@container.namespaces', '@cache.discovery', '@module_handler']
module_handler:
class: Drupal\Core\Extension\ModuleHandler
arguments: ['@app.root', '%container.modules%', '@cache.bootstrap']
arguments: ['%app.root%', '%container.modules%', '@cache.bootstrap']
module_installer:
class: Drupal\Core\Extension\ModuleInstaller
tags:
- { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator }
arguments: ['@app.root', '@module_handler', '@kernel']
arguments: ['%app.root%', '@module_handler', '@kernel']
lazy: true
extension.list.module:
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:
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:
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:
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:
class: Drupal\Core\Entity\ContentUninstallValidator
tags:
......@@ -545,7 +550,7 @@ services:
lazy: true
theme_handler:
class: Drupal\Core\Extension\ThemeHandler
arguments: ['@app.root', '@config.factory', '@extension.list.theme']
arguments: ['%app.root%', '@config.factory', '@extension.list.theme']
theme_installer:
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']
......@@ -696,23 +701,27 @@ services:
class: Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher
arguments: ['@service_container']
app.root:
class: SplString
class: \SplString
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:
- { name: parameter_service }
app.root.factory:
class: Drupal\Core\AppRootFactory
arguments: ['@kernel']
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:
class: SplString
class: \SplString
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:
- { name: parameter_service }
site.path.factory:
class: Drupal\Core\SitePathFactory
arguments: ['@kernel']
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:
class: Drupal\Core\Controller\ControllerResolver
arguments: ['@psr7.http_message_factory', '@class_resolver']
......@@ -1462,15 +1471,15 @@ services:
shared: false
theme.manager:
class: Drupal\Core\Theme\ThemeManager
arguments: ['@app.root', '@theme.negotiator', '@theme.initialization', '@module_handler']
arguments: ['%app.root%', '@theme.negotiator', '@theme.initialization', '@module_handler']
calls:
- [setThemeRegistry, ['@theme.registry']]
theme.initialization:
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:
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:
- { name: needs_destruction }
calls:
......@@ -1567,10 +1576,10 @@ services:
- { name: needs_destruction }
library.discovery.parser:
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:
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:
class: Drupal\Core\Asset\LibraryDependencyResolver
arguments: ['@library.discovery']
......@@ -1579,10 +1588,10 @@ services:
arguments: ['@library.discovery', '@library.dependency_resolver', '@module_handler', '@theme.manager', '@language_manager', '@cache.data']
info_parser:
class: Drupal\Core\Extension\InfoParser
arguments: ['@app.root']
arguments: ['%app.root%']
twig:
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:
- { name: service_collector, tag: 'twig.extension', call: addExtension }
twig.extension:
......@@ -1603,7 +1612,7 @@ services:
- { name: service_collector, tag: twig.loader, call: addLoader, required: TRUE }
twig.loader.filesystem:
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
# theme registry or via Twig namespaces.
arguments: ['.', '@module_handler', '@theme_handler']
......
......@@ -220,7 +220,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
// Attempt to reduce verbosity by removing DRUPAL_ROOT from the file path
// in the message. This does not happen for (false) security.
if (\Drupal::hasService('app.root')) {
if (\Drupal::hasService('kernel')) {
$root_length = strlen(\Drupal::root());
if (substr($error['%file'], 0, $root_length) == \Drupal::root()) {
$error['%file'] = substr($error['%file'], $root_length + 1);
......
......@@ -447,7 +447,7 @@ function install_begin_request($class_loader, &$install_state) {
->addTranslator($container->get('string_translator.file_translation'));
// 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([]);
$install_state['profiles'] += $listing->scan('profile');
......@@ -1896,7 +1896,7 @@ function install_check_translations($langcode, $server_pattern) {
$readable = FALSE;
$writable = FALSE;
// @todo: Make this configurable.
$site_path = \Drupal::service('site.path');
$site_path = \Drupal::getContainer()->getParameter('site.path');
$files_directory = $site_path . '/files';
$translations_directory = $site_path . '/files/translations';
$translations_directory_exists = FALSE;
......@@ -2075,7 +2075,7 @@ function install_check_requirements($install_state) {
foreach ($default_files as $default_file_info) {
$readable = FALSE;
$writable = FALSE;
$site_path = './' . \Drupal::service('site.path');
$site_path = './' . \Drupal::getContainer()->getParameter('site.path');
$file = $site_path . "/{$default_file_info['file']}";
$default_file = "./sites/default/{$default_file_info['file_default']}";
$exists = FALSE;
......
......@@ -217,7 +217,7 @@ function drupal_get_database_types() {
*/
function drupal_rewrite_settings($settings = [], $settings_file = NULL) {
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.
$variable_names = [];
......
......@@ -176,7 +176,7 @@ public static function hasService($id) {
* @return string
*/
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) {
* Gets the app root.
*
* @return string
* The app root.
*/
public function get() {
return $this->drupalKernel->getAppRoot();
return $this->drupalKernel->getContainer()->getParameter('app.root');
}
}
......@@ -43,7 +43,7 @@ public function getFormOptions(array $database) {
// Make the text more accurate for SQLite.
$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()]);
$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'];
return $form;
}
......
......@@ -896,6 +896,10 @@ protected function initializeContainer() {
// Only create a new class if we have a 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');
$container = new $class($container_definition);
}
......@@ -1271,6 +1275,9 @@ protected function compileContainer() {
}
$container->setParameter('persist_ids', $persist_ids);
$container->setParameter('app.root', $this->getAppRoot());
$container->setParameter('site.path', $this->getSitePath());
$container->compile();
return $container;
}
......
......@@ -182,8 +182,14 @@ public function __sleep() {
* Magic method implementation to unserialize the extension object.
*/
public function __wakeup() {
// Get the app root from the container.
$this->root = \Drupal::hasService('app.root') ? \Drupal::root() : DRUPAL_ROOT;
// Get the app root from the container. While compiling the container we
// 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 {
* @param string $site_path
* 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->fileCache = $use_file_cache ? FileCacheFactory::get('extension_discovery') : NULL;
$this->profileDirectories = $profile_directories;
......@@ -184,7 +184,7 @@ public function scan($type, $include_tests = NULL) {
// at install time. Therefore Kernel service is not always available, but is
// preferred.
if (\Drupal::hasService('kernel')) {
$searchdirs[static::ORIGIN_SITE] = \Drupal::service('site.path');
$searchdirs[static::ORIGIN_SITE] = \Drupal::getContainer()->getParameter('site.path');
}
else {
$searchdirs[static::ORIGIN_SITE] = $this->sitePath ?: DrupalKernel::findSitePath(Request::createFromGlobals());
......
......@@ -33,7 +33,7 @@ public function __construct(string $app_root = NULL) {
if ($app_root === NULL) {
// @todo https://www.drupal.org/project/drupal/issues/3087975 Require
// $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;
}
......
......@@ -36,7 +36,7 @@ public function __construct($root) {
* {@inheritdoc}
*/
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
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->get('site.path'),
$container->getParameter('app.root'),
$container->getParameter('site.path'),
$container->get('entity_type.manager')->getStorage('user'),
$container->get('state'),
$container->get('module_installer'),
......
......@@ -48,7 +48,7 @@ public function __construct($site_path, RendererInterface $renderer) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('site.path'),
$container->getParameter('site.path'),
$container->get('renderer')
);
}
......@@ -264,7 +264,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
* The path to the generated config sync directory.
*/
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
// 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)) {
......
......@@ -31,7 +31,7 @@ public function __construct(DrupalKernelInterface $drupal_kernel) {
* The site path.
*/
public function get() {
return $this->drupalKernel->getSitePath();
return $this->drupalKernel->getContainer()->getParameter('site.path');
}
}
......@@ -86,7 +86,7 @@ public static function baseUrl() {
*
* The site path is injectable from the site.path service:
* @code
* $base_path = PublicStream::basePath(\Drupal::service('site.path'));
* $base_path = PublicStream::basePath(\Drupal::getContainer()->getParameter('site.path'));
* @endcode
*
* @param string $site_path
......@@ -104,7 +104,7 @@ public static function basePath($site_path = NULL) {
// Find the site path. Kernel service is not always available at this
// point, but is preferred, when available.
if (\Drupal::hasService('kernel')) {
$site_path = \Drupal::service('site.path');
$site_path = \Drupal::getContainer()->getParameter('site.path');
}
else {
// If there is no kernel available yet, we call the static
......
......@@ -44,7 +44,7 @@ class PhpUnitTestRunner implements ContainerInjectionInterface {
*/
public static function create(ContainerInterface $container) {
return new static(
(string) $container->get('app.root'),
(string) $container->getParameter('app.root'),
(string) $container->get('file_system')->realpath('public://simpletest')
);
}
......
......@@ -77,7 +77,7 @@ public function boot() {
$this->getContainer()->get('module_handler')->loadAll();
$test_discovery = new TestDiscovery(
$this->getContainer()->get('app.root'),
$this->getContainer()->getParameter('app.root'),
$this->getContainer()->get('class_loader')
);
$test_discovery->registerTestNamespaces();
......
......@@ -19,7 +19,7 @@ class UpdateRegistryFactory implements ContainerAwareInterface {
* The update registry instance.
*/
public function create() {
return new UpdateRegistry($this->container->get('app.root'), $this->container->get('site.path'), array_keys($this->container->get('module_handler')->getModuleList()), $this->container->get('keyvalue')->get('post_update'));
return new UpdateRegistry($this->container->getParameter('app.root'), $this->container->getParameter('site.path'), array_keys($this->container->get('module_handler')->getModuleList()), $this->container->get('keyvalue')->get('post_update'));
}
}
......@@ -55,7 +55,7 @@ protected function setUp() {
$container = new ContainerBuilder();
$container->set('config.factory', $config_factory);
$container->set('theme_handler', $theme_handler);
$container->set('app.root', $this->root);
$container->setParameter('app.root', $this->root);
\Drupal::setContainer($container);
}
......
......@@ -26,7 +26,7 @@ public function getDescription() {
}
public function getDirectoryPath() {
return \Drupal::service('site.path') . '/files';
return \Drupal::getContainer()->getParameter('site.path') . '/files';
}
/**
......
......@@ -26,7 +26,7 @@ public function getDescription() {
}
public function getDirectoryPath() {
return \Drupal::service('site.path') . '/files';
return \Drupal::getContainer()->getParameter('site.path') . '/files';
}
/**
......
......@@ -24,7 +24,7 @@ class MigratePrivateFileTest extends MigrateDrupal7TestBase {
*/
protected function setUp() {
parent::setUp();
$this->setSetting('file_private_path', $this->container->get('site.path') . '/private');
$this->setSetting('file_private_path', $this->container->getParameter('site.path') . '/private');
$this->fileMigrationSetup();
}
......
......@@ -7,10 +7,10 @@ services:
public: false
plugin.manager.help_topic:
class: Drupal\help_topics\HelpTopicPluginManager
arguments: ['@module_handler', '@theme_handler', '@cache.discovery', '@app.root']
arguments: ['@module_handler', '@theme_handler', '@cache.discovery', '%app.root%']
help.twig.loader:
class: Drupal\help_topics\HelpTopicTwigLoader
arguments: ['@app.root', '@module_handler', '@theme_handler']
arguments: ['%app.root%', '@module_handler', '@theme_handler']
# Lowest core priority because loading help topics is not the usual case.
tags:
- { name: twig.loader, priority: -200 }
......
......@@ -48,7 +48,7 @@ public function testHelpTopics() {
$directories = $module_directories + $theme_directories +
$this->listDirectories('profile');
$directories['core'] = \Drupal::service('app.root') . '/core/help_topics';
$directories['core'] = \Drupal::root() . '/core/help_topics';
$directories['bad_help_topics'] = \Drupal::service('extension.list.module')->getPath('help_topics_test') . '/bad_help_topics/syntax/';
// Filter out directories outside of core. If you want to run this test
......
......@@ -207,7 +207,7 @@ services:
- { name: event_subscriber }
jsonapi.resource_response_validator.subscriber:
class: Drupal\jsonapi\EventSubscriber\ResourceResponseValidator
arguments: ['@logger.channel.jsonapi', '@module_handler', '@app.root']
arguments: ['@logger.channel.jsonapi', '@module_handler', '%app.root%']
calls:
- [setValidator, []]
tags:
......
......@@ -16,7 +16,7 @@
function locale_install() {
// Create the interface translations directory and ensure it's writable.
if (!$directory = \Drupal::config('locale.settings')->get('translation.path')) {
$site_path = \Drupal::service('site.path');
$site_path = \Drupal::getContainer()->getParameter('site.path');
$directory = $site_path . '/files/translations';
\Drupal::configFactory()->getEditable('locale.settings')->set('translation.path', $directory)->save();
}
......
......@@ -35,7 +35,7 @@ public function __construct($root) {
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root')
$container->getParameter('app.root')
);
}
......
......@@ -113,7 +113,7 @@ public function __construct($root, KeyValueExpirableFactoryInterface $key_value_
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('app.root'),
$container->getParameter('app.root'),
$container->get('keyvalue.expirable'),
$container->get('cache.default'),
$container->get('state'),
......
......@@ -487,7 +487,7 @@ function system_requirements($phase) {
// Find the site path. Kernel service is not always available at this point,
// but is preferred, when available.
if (\Drupal::hasService('kernel')) {
$site_path = \Drupal::service('site.path');
$site_path = \Drupal::getContainer()->getParameter('site.path');
}
else {
$site_path = DrupalKernel::findSitePath(Request::createFromGlobals());
......
......@@ -61,7 +61,7 @@ public function testModulesListFormWithInvalidInfoFile() {
name: Module With Broken Info file
type: module
BROKEN;
$path = \Drupal::service('site.path') . "/modules/broken";
$path = \Drupal::getContainer()->getParameter('site.path') . "/modules/broken";
mkdir($path, 0777, TRUE);
file_put_contents("$path/broken.info.yml", $broken_info_yml);
......
......@@ -80,7 +80,7 @@ public static function create(ContainerInterface $container) {
return new static(
$container->get('update.root'),
$container->get('module_handler'),
$container->get('site.path'),
$container->getParameter('site.path'),
$container->get('plugin.manager.archiver')
);
}
......
......@@ -80,7 +80,7 @@ public static function create(ContainerInterface $container) {
$container->get('update.root'),
$container->get('module_handler'),
$container->get('state'),
$container->get('site.path')
$container->getParameter('site.path')
);
}
......
......@@ -318,7 +318,7 @@ function update_manager_local_transfers_allowed() {
// the configuration directory to determine if local transfers will be
// allowed.
$temporary_file = \Drupal::service('file_system')->tempnam('temporary://', 'update_');
$site_path = \Drupal::service('site.path');
$site_path = \Drupal::getContainer()->getParameter('site.path');
$local_transfers_allowed = fileowner($temporary_file) === fileowner($site_path);
// Clean up. If this fails, we can ignore it (since this is just a temporary
......
......@@ -87,7 +87,7 @@ public function setUp() {
->set('http_handler_stack', $handler_stack);
$this->container
->set('app.root', DRUPAL_ROOT);
->setParameter('app.root', DRUPAL_ROOT);
\Drupal::setContainer($this->container);
// Setup Mink.
......