protected function ConfigInstaller::findPreExistingConfiguration in Drupal 9
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/Config/ConfigInstaller.php \Drupal\Core\Config\ConfigInstaller::findPreExistingConfiguration()
Finds pre-existing configuration objects for the provided extension.
Extensions can not be installed if configuration objects exist in the active storage with the same names. This can happen in a number of ways, commonly:
- if a user has created configuration with the same name as that provided by the extension.
- if the extension provides default configuration that does not depend on it and the extension has been uninstalled and is about to the reinstalled.
Return value
array Array of configuration object names that already exist keyed by collection.
1 call to ConfigInstaller::findPreExistingConfiguration()
- ConfigInstaller::checkConfigurationToInstall in core/
lib/ Drupal/ Core/ Config/ ConfigInstaller.php - Checks the configuration that will be installed for an extension.
File
- core/
lib/ Drupal/ Core/ Config/ ConfigInstaller.php, line 484
Class
Namespace
Drupal\Core\ConfigCode
protected function findPreExistingConfiguration(StorageInterface $storage) {
$existing_configuration = [];
// Gather information about all the supported collections.
$collection_info = $this->configManager
->getConfigCollectionInfo();
foreach ($collection_info
->getCollectionNames() as $collection) {
$config_to_create = array_keys($this
->getConfigToCreate($storage, $collection));
$active_storage = $this
->getActiveStorages($collection);
foreach ($config_to_create as $config_name) {
if ($active_storage
->exists($config_name)) {
$existing_configuration[$collection][] = $config_name;
}
}
}
return $existing_configuration;
}