diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 7f7cc11..ae12c91 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -112,7 +112,7 @@ public function installDefaultConfig($type, $name) { $prefix = $name . '.'; } - // Gets a profile storage to search for overrides if necessary. + // Gets profile storages to search for overrides if necessary. $profile_storages = $this->getProfileStorages($name); // Gather information about all the supported collections. @@ -438,7 +438,7 @@ public function checkConfigurationToInstall($type, $name) { $enabled_extensions = $this->getEnabledExtensions(); // Add the extension that will be enabled to the list of enabled extensions. $enabled_extensions[] = $name; - // Gets a profile storage to search for overrides if necessary. + // Gets profile storages to search for overrides if necessary. $profile_storages = $this->getProfileStorages($name); // Check the dependencies of configuration provided by the module. @@ -559,9 +559,9 @@ protected function getEnabledExtensions() { * Gets the profile storage to use to check for profile overrides. * * The install profile can override module configuration during a module - * install. Both the install and optional directories are checking for - * matching configuration. This allows profiles to override default - * configuration for modules they do not depend on. + * install. Both the install and optional directories are checked for matching + * configuration. This allows profiles to override default configuration for + * modules they do not depend on. * * @param string $installing_name * (optional) The name of the extension currently being installed. @@ -575,11 +575,12 @@ protected function getProfileStorages($installing_name = '') { $profile = $this->drupalGetProfile(); $profile_storages = []; if ($profile && $profile != $installing_name) { - // Profiles should not contain optional configuration so always use the - // install directory. $profile_path = $this->drupalGetPath('module', $profile); - $profile_storages[] = new FileStorage($profile_path . '/' . InstallStorage::CONFIG_INSTALL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION); - $profile_storages[] = new FileStorage($profile_path . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY, StorageInterface::DEFAULT_COLLECTION); + foreach ([InstallStorage::CONFIG_INSTALL_DIRECTORY, InstallStorage::CONFIG_OPTIONAL_DIRECTORY] as $directory) { + if (is_dir($profile_path . '/' . $directory)) { + $profile_storages[] = new FileStorage($profile_path . '/' . $directory, StorageInterface::DEFAULT_COLLECTION); + } + } } return $profile_storages; }