diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index d957713..a49792f 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -149,7 +149,7 @@ public function installDefaultConfig($type, $name) { // Install any optional configuration entities whose dependencies can now // be met. This searches all the installed modules config/optional // directories. - $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), \Drupal::installProfile(), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), $this->installProfile, InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE); $this->installOptionalConfig($storage, [$type => $name]); } @@ -164,7 +164,7 @@ public function installOptionalConfig(StorageInterface $storage = NULL, $depende $optional_profile_config = []; if (!$storage) { // Search the install profile's optional configuration too. - $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), \Drupal::installProfile(), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), $this->installProfile, InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE); // The extension install storage ensures that overrides are used. $profile_storage = NULL; } @@ -339,7 +339,7 @@ protected function createConfiguration($collection, array $config_to_create) { * {@inheritdoc} */ public function installCollectionDefaultConfig($collection) { - $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), \Drupal::installProfile(), InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, $this->drupalInstallationAttempted()); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), $this->installProfile, InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, $this->drupalInstallationAttempted()); // Only install configuration for enabled extensions. $enabled_extensions = $this->getEnabledExtensions(); $config_to_install = array_filter($storage->listAll(), function ($config_name) use ($enabled_extensions) { diff --git a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php index 460dd34..1943940 100644 --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -27,11 +27,11 @@ class ExtensionInstallStorage extends InstallStorage { protected $includeProfile = TRUE; /** - * Current install profile. + * The name of the currently active installation profile. * * @var string */ - protected $profile; + protected $installProfile; /** * Overrides \Drupal\Core\Config\InstallStorage::__construct(). @@ -54,7 +54,7 @@ public function __construct(StorageInterface $config_storage, $profile, $directo $this->directory = $directory; $this->collection = $collection; $this->includeProfile = $include_profile; - $this->profile = $profile; + $this->installProfile = $profile; } /** @@ -91,14 +91,14 @@ protected function getAllFolders() { if (!empty($extensions['module'])) { $modules = $extensions['module']; // Remove the install profile as this is handled later. - unset($modules[$this->profile]); + unset($modules[$this->installProfile]); $profile_list = $listing->scan('profile'); - if ($this->profile && isset($profile_list[$this->profile])) { + if ($this->installProfile && isset($profile_list[$this->installProfile])) { // Prime the drupal_get_filename() static cache with the profile info // file location so we can use drupal_get_path() on the active profile // during the module scan. // @todo Remove as part of https://www.drupal.org/node/2186491 - drupal_get_filename('profile', $this->profile, $profile_list[$this->profile]->getPathname()); + drupal_get_filename('profile', $this->installProfile, $profile_list[$this->installProfile]->getPathname()); } $module_list_scan = $listing->scan('module'); $module_list = array(); @@ -123,12 +123,12 @@ protected function getAllFolders() { // The install profile can override module default configuration. We do // this by replacing the config file path from the module/theme with the // install profile version if there are any duplicates. - if ($this->profile) { + if ($this->installProfile) { if (!isset($profile_list)) { $profile_list = $listing->scan('profile'); } - if (isset($profile_list[$this->profile])) { - $profile_folders = $this->getComponentNames(array($profile_list[$this->profile])); + if (isset($profile_list[$this->installProfile])) { + $profile_folders = $this->getComponentNames(array($profile_list[$this->installProfile])); $this->folders = $profile_folders + $this->folders; } } diff --git a/core/modules/locale/locale.services.yml b/core/modules/locale/locale.services.yml index e37cb48..b9f8fb8 100644 --- a/core/modules/locale/locale.services.yml +++ b/core/modules/locale/locale.services.yml @@ -1,7 +1,7 @@ services: locale.default.config.storage: class: Drupal\locale\LocaleDefaultConfigStorage - arguments: ['@config.storage', '@language_manager'] + arguments: ['@config.storage', '@language_manager', '%install_profile%'] public: false locale.config_manager: class: Drupal\locale\LocaleConfigManager diff --git a/core/modules/locale/src/LocaleDefaultConfigStorage.php b/core/modules/locale/src/LocaleDefaultConfigStorage.php index 5f6b9f0..bcb242b 100644 --- a/core/modules/locale/src/LocaleDefaultConfigStorage.php +++ b/core/modules/locale/src/LocaleDefaultConfigStorage.php @@ -57,12 +57,12 @@ class LocaleDefaultConfigStorage { * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager * The language manager. */ - public function __construct(StorageInterface $config_storage, ConfigurableLanguageManagerInterface $language_manager) { + public function __construct(StorageInterface $config_storage, ConfigurableLanguageManagerInterface $language_manager, $install_profile) { $this->configStorage = $config_storage; $this->languageManager = $language_manager; - $this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage, \Drupal::installProfile()); - $this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, \Drupal::installProfile(), ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY); + $this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage, $install_profile); + $this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, $install_profile, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY); } /** diff --git a/core/modules/simpletest/src/KernelTestBase.php b/core/modules/simpletest/src/KernelTestBase.php index 56dfe6f..8f97401 100644 --- a/core/modules/simpletest/src/KernelTestBase.php +++ b/core/modules/simpletest/src/KernelTestBase.php @@ -311,9 +311,6 @@ public function containerBuild(ContainerBuilder $container) { // Set the default language on the minimal container. $this->container->setParameter('language.default_values', $this->defaultLanguageData()); - // Use the testing install profile. - $container->setParameter('install_profile', 'testing'); - $container->register('lock', 'Drupal\Core\Lock\NullLockBackend'); $container->register('cache_factory', 'Drupal\Core\Cache\MemoryBackendFactory'); diff --git a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php index ab954e3..d0e6547 100644 --- a/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php +++ b/core/modules/system/src/Tests/Bootstrap/GetFilenameUnitTest.php @@ -13,6 +13,15 @@ class GetFilenameUnitTest extends KernelTestBase { /** + * {@inheritdoc} + */ + public function containerBuild(ContainerBuilder $container) { + parent::containerBuild($container); + // Use the testing install profile. + $container->setParameter('install_profile', 'testing'); + } + + /** * Tests that drupal_get_filename() works when the file is not in database. */ function testDrupalGetFilename() {