diff --git a/core/core.services.yml b/core/core.services.yml index d67a6fa..dbb1db9 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -328,7 +328,7 @@ services: - { name: backend_overridable } config.storage.schema: class: Drupal\Core\Config\ExtensionInstallStorage - arguments: ['@config.storage', '%install_profile%', 'config/schema'] + arguments: ['@config.storage', 'config/schema', '', true, '%install_profile%'] config.typed: class: Drupal\Core\Config\TypedConfigManager arguments: ['@config.storage', '@config.storage.schema', '@cache.discovery', '@module_handler'] diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 4608055..5a61f9c 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), $this->installProfile, InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, FALSE, $this->installProfile); $this->installOptionalConfig($storage, [$type => $name]); } @@ -165,7 +165,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), $this->installProfile, InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION, TRUE, $this->installProfile); // The extension install storage ensures that overrides are used. $profile_storage = NULL; } @@ -340,7 +340,7 @@ protected function createConfiguration($collection, array $config_to_create) { * {@inheritdoc} */ public function installCollectionDefaultConfig($collection) { - $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), $this->installProfile, InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, $this->drupalInstallationAttempted()); + $storage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, $this->drupalInstallationAttempted(), $this->installProfile); // 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 96e1e38..9289434 100644 --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -39,8 +39,6 @@ class ExtensionInstallStorage extends InstallStorage { * @param \Drupal\Core\Config\StorageInterface $config_storage * The active configuration store where the list of enabled modules and * themes is stored. - * @param string $profile - * The current installation profile. * @param string $directory * The directory to scan in each extension to scan for files. Defaults to * 'config/install'. @@ -50,13 +48,17 @@ class ExtensionInstallStorage extends InstallStorage { * @param bool $include_profile * (optional) Whether to include the install profile in extensions to * search and to get overrides from. + * @param string $profile + * The current installation profile. */ - public function __construct(StorageInterface $config_storage, $profile, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE) { + public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE, $profile = NULL) { parent::__construct($directory, $collection); - $this->configStorage = $config_storage; $this->includeProfile = $include_profile; - $this->installProfile = $profile; + if (is_null($profile)) { + @trigger_error('Install profile will be a mandatory parameter in Drupal 9.0.', E_USER_DEPRECATED); + } + $this->installProfile = $profile ?: \Drupal::installProfile(); } /** diff --git a/core/modules/locale/src/LocaleDefaultConfigStorage.php b/core/modules/locale/src/LocaleDefaultConfigStorage.php index bcb242b..fb4e352 100644 --- a/core/modules/locale/src/LocaleDefaultConfigStorage.php +++ b/core/modules/locale/src/LocaleDefaultConfigStorage.php @@ -61,8 +61,8 @@ public function __construct(StorageInterface $config_storage, ConfigurableLangua $this->configStorage = $config_storage; $this->languageManager = $language_manager; - $this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage, $install_profile); - $this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, $install_profile, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY); + $this->requiredInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_INSTALL_DIRECTORY, ExtensionInstallStorage::DEFAULT_COLLECTION, TRUE, $install_profile); + $this->optionalInstallStorage = new ExtensionInstallStorage($this->configStorage, ExtensionInstallStorage::CONFIG_OPTIONAL_DIRECTORY, ExtensionInstallStorage::DEFAULT_COLLECTION, TRUE, $install_profile); } /**