diff --git a/core/lib/Drupal/Core/Config/FileStorage.php b/core/lib/Drupal/Core/Config/FileStorage.php index f404480..1816ec9 100644 --- a/core/lib/Drupal/Core/Config/FileStorage.php +++ b/core/lib/Drupal/Core/Config/FileStorage.php @@ -231,7 +231,7 @@ public function deleteAll($prefix = '') { } if ($success && $this->collection != StorageInterface::DEFAULT_COLLECTION) { // Remove empty directories. - if (!(new \FilesystemIterator($this->getCollectionDirectory()))->valid()) { + if (file_exists($this->getCollectionDirectory()) && !(new \FilesystemIterator($this->getCollectionDirectory()))->valid()) { drupal_rmdir($this->getCollectionDirectory()); } } diff --git a/core/modules/config/src/Tests/ConfigExportUITest.php b/core/modules/config/src/Tests/ConfigExportUITest.php index fe3ae8d..f8f1db0 100644 --- a/core/modules/config/src/Tests/ConfigExportUITest.php +++ b/core/modules/config/src/Tests/ConfigExportUITest.php @@ -64,6 +64,8 @@ function testExport() { $config_files = array(); foreach ($storage_active->listAll() as $config_name) { $config_files[] = $config_name . '.yml'; + // All active configuration in this test was installed with a project. + $config_files[] = 'originalcopy/' . $config_name . '.yml'; } // Assert that the downloaded archive file contents are the same as the test // site active store. diff --git a/core/modules/config/src/Tests/ConfigInstallTest.php b/core/modules/config/src/Tests/ConfigInstallTest.php index 2da9e53..ed761c5 100644 --- a/core/modules/config/src/Tests/ConfigInstallTest.php +++ b/core/modules/config/src/Tests/ConfigInstallTest.php @@ -167,6 +167,7 @@ public function testCollectionInstallationCollections() { public function testCollectionInstallationCollectionConfigEntity() { $collections = array( 'entity', + StorageInterface::ORIGINAL_COPY_COLLECTION, ); \Drupal::state()->set('config_collection_install_test.collection_names', $collections); // Install the test module. diff --git a/core/modules/config/tests/config_import_test/src/EventSubscriber.php b/core/modules/config/tests/config_import_test/src/EventSubscriber.php index 0be4f97..3549ed3 100644 --- a/core/modules/config/tests/config_import_test/src/EventSubscriber.php +++ b/core/modules/config/tests/config_import_test/src/EventSubscriber.php @@ -10,6 +10,7 @@ use Drupal\Core\Config\ConfigCrudEvent; use Drupal\Core\Config\ConfigEvents; use Drupal\Core\Config\ConfigImporterEvent; +use Drupal\Core\Config\StorageInterface; use Drupal\Core\State\StateInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -58,7 +59,7 @@ public function onConfigImporterValidate(ConfigImporterEvent $event) { */ public function onConfigSave(ConfigCrudEvent $event) { $config = $event->getConfig(); - if ($config->getName() == 'action.settings') { + if ($config->getStorage()->getCollectionName() == StorageInterface::DEFAULT_COLLECTION && $config->getName() == 'action.settings') { $values = $this->state->get('ConfigImportUITest.action.settings.recursion_limit', array()); $values[] = $config->get('recursion_limit'); $this->state->set('ConfigImportUITest.action.settings.recursion_limit', $values); @@ -90,7 +91,7 @@ public function onConfigSave(ConfigCrudEvent $event) { */ public function onConfigDelete(ConfigCrudEvent $event) { $config = $event->getConfig(); - if ($config->getName() == 'action.settings') { + if ($config->getStorage()->getCollectionName() == StorageInterface::DEFAULT_COLLECTION && $config->getName() == 'action.settings') { $value = $this->state->get('ConfigImportUITest.action.settings.delete', 0); $this->state->set('ConfigImportUITest.action.settings.delete', $value + 1); } diff --git a/core/modules/simpletest/src/TestBase.php b/core/modules/simpletest/src/TestBase.php index f71e323..e192293 100644 --- a/core/modules/simpletest/src/TestBase.php +++ b/core/modules/simpletest/src/TestBase.php @@ -1614,9 +1614,15 @@ public function configImporter() { * The target config storage service. */ public function copyConfig(StorageInterface $source_storage, StorageInterface $target_storage) { - $target_storage->deleteAll(); - foreach ($source_storage->listAll() as $name) { - $target_storage->write($name, $source_storage->read($name)); + $collections = $source_storage->getAllCollectionNames(); + $collections[] = StorageInterface::DEFAULT_COLLECTION; + foreach ($collections as $collection) { + $source_collection = $source_storage->createCollection($collection); + $target_collection = $target_storage->createCollection($collection); + $target_collection->deleteAll(); + foreach ($source_collection->listAll() as $name) { + $target_collection->write($name, $source_collection->read($name)); + } } } diff --git a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php index 17dfb13..43be83e 100644 --- a/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php +++ b/core/lib/Drupal/Core/Config/ConfigCollectionInfo.php @@ -41,9 +41,6 @@ public function addCollection($collection, ConfigFactoryOverrideInterface $overr if ($collection == StorageInterface::DEFAULT_COLLECTION) { throw new \InvalidArgumentException('Can not add the default collection to the ConfigCollectionInfo object'); } - if ($collection == StorageInterface::ORIGINAL_COPY_COLLECTION) { - throw new \InvalidArgumentException('Can not add the original copy collection to the ConfigCollectionInfo object'); - } $this->collections[$collection] = $override_service; }