diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 04f517d..a77bb1c 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -280,7 +280,10 @@ protected function createConfiguration($collection, array $config_to_create) { } if ($config_to_create[$name] !== FALSE) { $new_config->setData($config_to_create[$name]); - if (!$this->isSyncing()) { + // Add a hash to configuration created through the installer so it is + // possible to know if the configuration was created by installing an + // extension and to track which version of the default config was used. + if (!$this->isSyncing() && $collection == StorageInterface::DEFAULT_COLLECTION) { $new_config->set('_core.default_config_hash', Crypt::hashBase64(serialize($config_to_create[$name]))); } } diff --git a/core/modules/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/src/Tests/ConfigCRUDTest.php index e127892..3d61c9e 100644 --- a/core/modules/config/src/Tests/ConfigCRUDTest.php +++ b/core/modules/config/src/Tests/ConfigCRUDTest.php @@ -7,6 +7,7 @@ namespace Drupal\config\Tests; +use Drupal\Component\Utility\Crypt; use Drupal\Component\Utility\SafeMarkup; use Drupal\Core\Config\ConfigNameException; use Drupal\Core\Config\ConfigValueException; @@ -263,6 +264,7 @@ public function testDataTypes() { 'string' => 'string', 'string_int' => '1', ); + $data['_core']['default_config_hash'] = Crypt::hashBase64(serialize($data)); $this->assertIdentical($config->get(), $data); // Re-set each key using Config::set(). diff --git a/core/modules/config/src/Tests/ConfigDiffTest.php b/core/modules/config/src/Tests/ConfigDiffTest.php index efb5db3..372970f 100644 --- a/core/modules/config/src/Tests/ConfigDiffTest.php +++ b/core/modules/config/src/Tests/ConfigDiffTest.php @@ -35,13 +35,10 @@ function testDiff() { $add_key = 'biff'; $add_data = 'bangpow'; $change_data = 'foobar'; - $original_data = array( - 'foo' => 'bar', - '404' => 'herp', - ); // Install the default config. $this->installConfig(array('config_test')); + $original_data = \Drupal::config($config_name)->get(); // Change a configuration value in sync. $sync_data = $original_data; diff --git a/core/modules/config/src/Tests/ConfigInstallProfileOverrideTest.php b/core/modules/config/src/Tests/ConfigInstallProfileOverrideTest.php index e10dfe0..36697a5 100644 --- a/core/modules/config/src/Tests/ConfigInstallProfileOverrideTest.php +++ b/core/modules/config/src/Tests/ConfigInstallProfileOverrideTest.php @@ -7,6 +7,7 @@ namespace Drupal\config\Tests; +use Drupal\Component\Utility\Crypt; use Drupal\Core\Config\InstallStorage; use Drupal\simpletest\WebTestBase; use Drupal\Core\Config\FileStorage; @@ -48,6 +49,7 @@ function testInstallProfileConfigOverwrite() { 'requirements_error' => 1209600, ), ); + $expected_profile_data['_core']['default_config_hash'] = Crypt::hashBase64(serialize($expected_profile_data)); // Verify that the original data matches. We have to read the module config // file directly, because the install profile default system.cron.yml diff --git a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php index f08c7bd..088129a 100644 --- a/core/modules/config/src/Tests/ConfigSingleImportExportTest.php +++ b/core/modules/config/src/Tests/ConfigSingleImportExportTest.php @@ -202,7 +202,7 @@ public function testExport() { $this->assertIdentical($expected_options, array_intersect($expected_options, $options), 'The expected configuration files are listed.'); $this->drupalGet('admin/config/development/configuration/single/export/system.simple/system.image'); - $this->assertFieldByXPath('//textarea[@name="export"]', "toolkit: gd\n", 'The expected system configuration is displayed.'); + $this->assertFieldByXPath('//textarea[@name="export"]', "toolkit: gd\n_core:\n default_config_hash: durWHaKeBaq4d9Wpi4RqwADj1OufDepcnJuhVLmKN24\n", 'The expected system configuration is displayed.'); $this->drupalGet('admin/config/development/configuration/single/export/date_format'); $this->assertFieldByXPath('//select[@name="config_type"]//option[@selected="selected"]', t('Date format'), 'The date format entity type is selected when specified in the URL.'); diff --git a/core/modules/user/src/Tests/Migrate/d7/MigrateUserFloodTest.php b/core/modules/user/src/Tests/Migrate/d7/MigrateUserFloodTest.php index 786fcd2..020e15c 100644 --- a/core/modules/user/src/Tests/Migrate/d7/MigrateUserFloodTest.php +++ b/core/modules/user/src/Tests/Migrate/d7/MigrateUserFloodTest.php @@ -35,6 +35,9 @@ public function testMigration() { 'ip_window' => 7200, 'user_limit' => 22, 'user_window' => 86400, + '_core' => [ + 'default_config_hash' => 'UYfMzeP1S8jKm9PSvxf7nQNe8DsNS-3bc2WSNNXBQWs', + ], ]; $this->assertIdentical($expected, $this->config('user.flood')->get()); }