diff --git a/composer.json b/composer.json index 983ddd5bf2e53054100184e21f4ad5377fcf7dd1..d156a159e1777f51640c60fa80752d32a228d4a1 100644 --- a/composer.json +++ b/composer.json @@ -100,6 +100,7 @@ "drupal/cache_control_override": "^1.0@alpha", "drupal/ckeditor_indentblock": "1.0.0-beta2", "drupal/config_direct_save": "2.1", + "drupal/config_filter": "1.9", "drupal/config_ignore": "2.3", "drupal/config_update": "1.7", "drupal/console": "1.9.7", diff --git a/composer.lock b/composer.lock index eb2a91fc64d84de08c42e9913be94d0c153c1996..3be22a5b50b04bb477c1c35d5196b924cd177896 100644 --- a/composer.lock +++ b/composer.lock @@ -2459,17 +2459,17 @@ }, { "name": "drupal/config_filter", - "version": "1.8.0", + "version": "1.9.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/config_filter.git", - "reference": "8.x-1.8" + "reference": "8.x-1.9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "5def5f97e79d6f5af6bb7007f012443475c90bfe" + "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-1.9.zip", + "reference": "8.x-1.9", + "shasum": "cf6919fc5039771f8e6c2ed203f29ab0eca8d91f" }, "require": { "drupal/core": "^8 || ^9" @@ -2480,8 +2480,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.8", - "datestamp": "1603870062", + "version": "8.x-1.9", + "datestamp": "1649336052", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 9b86767a2dc6bf94bc7e8d9d00b218dd02dc84c5..653e7f75f7f5ca4326d72de2fd7337cc0ccef33f 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2539,18 +2539,18 @@ }, { "name": "drupal/config_filter", - "version": "1.8.0", - "version_normalized": "1.8.0.0", + "version": "1.9.0", + "version_normalized": "1.9.0.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/config_filter.git", - "reference": "8.x-1.8" + "reference": "8.x-1.9" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-1.8.zip", - "reference": "8.x-1.8", - "shasum": "5def5f97e79d6f5af6bb7007f012443475c90bfe" + "url": "https://ftp.drupal.org/files/projects/config_filter-8.x-1.9.zip", + "reference": "8.x-1.9", + "shasum": "cf6919fc5039771f8e6c2ed203f29ab0eca8d91f" }, "require": { "drupal/core": "^8 || ^9" @@ -2561,8 +2561,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.8", - "datestamp": "1603870062", + "version": "8.x-1.9", + "datestamp": "1649336052", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index f2d9fab622d876394f53446385136984c3420cd4..db280c548458f2ab02c3ffef1e15913df4071d28 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -503,12 +503,12 @@ 'dev_requirement' => false, ), 'drupal/config_filter' => array( - 'pretty_version' => '1.8.0', - 'version' => '1.8.0.0', + 'pretty_version' => '1.9.0', + 'version' => '1.9.0.0', 'type' => 'drupal-module', 'install_path' => __DIR__ . '/../../web/modules/config_filter', 'aliases' => array(), - 'reference' => '8.x-1.8', + 'reference' => '8.x-1.9', 'dev_requirement' => false, ), 'drupal/config_ignore' => array( diff --git a/web/modules/config_filter/config_filter.info.yml b/web/modules/config_filter/config_filter.info.yml index 1cef5653b692ce194efd318144973193a3c18ad0..9d50c853309506b428e7d066ca4e128e46324be5 100644 --- a/web/modules/config_filter/config_filter.info.yml +++ b/web/modules/config_filter/config_filter.info.yml @@ -5,7 +5,7 @@ core: 8.x core_version_requirement: ^8 || ^9 package: Config -# Information added by Drupal.org packaging script on 2020-10-28 -version: '8.x-1.8' +# Information added by Drupal.org packaging script on 2022-04-07 +version: '8.x-1.9' project: 'config_filter' -datestamp: 1603870063 +datestamp: 1649336058 diff --git a/web/modules/config_filter/tests/modules/config_filter_split_test/config_filter_split_test.info.yml b/web/modules/config_filter/tests/modules/config_filter_split_test/config_filter_split_test.info.yml index 231453b850f909f655432e46ba37b53af31cdfcd..32c02faf24a93b2896ab3c66bce8143f98eb587a 100644 --- a/web/modules/config_filter/tests/modules/config_filter_split_test/config_filter_split_test.info.yml +++ b/web/modules/config_filter/tests/modules/config_filter_split_test/config_filter_split_test.info.yml @@ -6,7 +6,7 @@ package: Testing dependencies: - config_filter:config_filter -# Information added by Drupal.org packaging script on 2020-10-28 -version: '8.x-1.8' +# Information added by Drupal.org packaging script on 2022-04-07 +version: '8.x-1.9' project: 'config_filter' -datestamp: 1603870063 +datestamp: 1649336058 diff --git a/web/modules/config_filter/tests/modules/config_filter_test/config_filter_test.info.yml b/web/modules/config_filter/tests/modules/config_filter_test/config_filter_test.info.yml index 7fec84b0ed2201e791d92042e719137f64189826..3d4835ec3999a81b68064d0fb177584460bf4d05 100644 --- a/web/modules/config_filter/tests/modules/config_filter_test/config_filter_test.info.yml +++ b/web/modules/config_filter/tests/modules/config_filter_test/config_filter_test.info.yml @@ -6,7 +6,7 @@ package: Testing dependencies: - config_filter:config_filter -# Information added by Drupal.org packaging script on 2020-10-28 -version: '8.x-1.8' +# Information added by Drupal.org packaging script on 2022-04-07 +version: '8.x-1.9' project: 'config_filter' -datestamp: 1603870063 +datestamp: 1649336058 diff --git a/web/modules/config_filter/tests/src/Kernel/ConfigFilterStorageFactoryTest.php b/web/modules/config_filter/tests/src/Kernel/ConfigFilterStorageFactoryTest.php index 3056cff58f8e126a433d2c23cbc0db8ee66dcd04..2e089d745375afd5a430d64d1a5556c7ce3d7100 100644 --- a/web/modules/config_filter/tests/src/Kernel/ConfigFilterStorageFactoryTest.php +++ b/web/modules/config_filter/tests/src/Kernel/ConfigFilterStorageFactoryTest.php @@ -13,6 +13,8 @@ */ class ConfigFilterStorageFactoryTest extends KernelTestBase { + use ConfigStorageTestTrait; + /** * {@inheritdoc} */ @@ -38,7 +40,7 @@ public function testServiceProvider() { // Config Filter makes the sync storage a filtered storage. $this->assertInstanceOf(FilteredStorageInterface::class, $this->container->get('config.storage.sync')); // Export the configuration. The pirate filter changes system.site. - $this->copyConfig($this->container->get('config.storage'), $this->container->get('config.storage.sync')); + $this->copyConfig($this->getExportStorage(), $this->getSyncFileStorage()); // The pirate filter changes the system.site when importing. $this->assertEquals(['system.site'], $this->configImporter()->getStorageComparer()->getChangelist('update')); diff --git a/web/modules/config_filter/tests/src/Kernel/ConfigStorageTestTrait.php b/web/modules/config_filter/tests/src/Kernel/ConfigStorageTestTrait.php index 3a6fee528e5cf73562335e855ffc1c88214caf8d..0d8e29309593534180c01114391c563aebffb4b3 100644 --- a/web/modules/config_filter/tests/src/Kernel/ConfigStorageTestTrait.php +++ b/web/modules/config_filter/tests/src/Kernel/ConfigStorageTestTrait.php @@ -113,7 +113,7 @@ protected function getExportStorage(): StorageInterface { // Create a filtered storage. $filtered = $this->container->get('config_filter.storage_factory')->getFilteredStorage($memory, ['config.storage.sync']); // Then write the core export storage to this new storage. - $this->copyConfig($unfiltered, $filtered); + self::replaceAllStorageContents($unfiltered, $filtered); return $memory; } @@ -155,4 +155,42 @@ protected static function assertStorageEquals(StorageInterface $expected, Storag } } + /** + * Copy the configuration from one storage to another and remove stale items. + * + * This method is the copy of how it worked prior to Drupal 9.4. + * See https://www.drupal.org/node/3273823 for more details. + * + * @param \Drupal\Core\Config\StorageInterface $source + * The configuration storage to copy from. + * @param \Drupal\Core\Config\StorageInterface $target + * The configuration storage to copy to. + */ + private static function replaceAllStorageContents(StorageInterface $source, StorageInterface &$target) { + // Make sure there is no stale configuration in the target storage. + foreach (array_merge([StorageInterface::DEFAULT_COLLECTION], $target->getAllCollectionNames()) as $collection) { + $target->createCollection($collection)->deleteAll(); + } + + // Copy all the configuration from all the collections. + foreach (array_merge([StorageInterface::DEFAULT_COLLECTION], $source->getAllCollectionNames()) as $collection) { + $source_collection = $source->createCollection($collection); + $target_collection = $target->createCollection($collection); + foreach ($source_collection->listAll() as $name) { + $data = $source_collection->read($name); + if ($data !== FALSE) { + $target_collection->write($name, $data); + } + else { + \Drupal::logger('config')->notice('Missing required data for configuration: %config', [ + '%config' => $name, + ]); + } + } + } + + // Make sure that the target is set to the same collection as the source. + $target = $target->createCollection($source->getCollectionName()); + } + }