diff --git a/core/lib/Drupal/Core/Config/ConfigImporter.php b/core/lib/Drupal/Core/Config/ConfigImporter.php index 715138f..3f7db46 100644 --- a/core/lib/Drupal/Core/Config/ConfigImporter.php +++ b/core/lib/Drupal/Core/Config/ConfigImporter.php @@ -786,8 +786,7 @@ protected function processExtension($type, $op, $name) { $this->setProcessedExtension($type, $op, $name); \Drupal::service('config.installer') - ->setSyncing(FALSE) - ->resetSourceStorage(); + ->setSyncing(FALSE); } /** diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 96c042b..b5aeb7f 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -10,8 +10,6 @@ use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\Entity\ConfigDependencyManager; use Drupal\Core\Entity\EntityTypeInterface; -use Drupal\Core\Site\Settings; -use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ConfigInstaller implements ConfigInstallerInterface { @@ -321,10 +319,17 @@ public function setSourceStorage(StorageInterface $storage) { } /** - * {@inheritdoc} + * Resets the configuration storage that provides the default configuration. + * + * @return $this */ - public function resetSourceStorage() { - $this->sourceStorage = null; + protected function resetSourceStorage() { + // Do not reset the source storage when synchronizing configuration, since + // that would needlessly trigger a reload of the whole configuration to + // be imported. + if (!$this->isSyncing()) { + $this->sourceStorage = NULL; + } return $this; } @@ -335,18 +340,12 @@ public function resetSourceStorage() { * (optional) The configuration collection. Defaults to the default * collection. * - * @return \Drupal\Core\Config\StorageInterface + * @return \Drupal\Core\Config\StorageInterface|null * The configuration storage that provides the default configuration. + * Returns null if the source storage has not been set. */ public function getSourceStorage($collection = StorageInterface::DEFAULT_COLLECTION) { - if (!isset($this->sourceStorage)) { - throw new ConfigException('This should not happen'); - // Default to using the ExtensionInstallStorage which searches extension's - // config directories for default configuration. Only include the profile - // configuration during Drupal installation. - // $this->sourceStorage = new ExtensionInstallStorage($this->getActiveStorages(StorageInterface::DEFAULT_COLLECTION), InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, drupal_installation_attempted()); - } - if ($this->sourceStorage->getCollectionName() != $collection) { + if (isset($this->sourceStorage) && $this->sourceStorage->getCollectionName() != $collection) { $this->sourceStorage = $this->sourceStorage->createCollection($collection); } return $this->sourceStorage; @@ -446,7 +445,7 @@ public function checkConfigurationToInstall($type, $name) { // has the same name as a module's configuration will be used instead. if ($name != $this->drupalGetProfile()) { // Throw an exception if the module being installed contains configuration - // that already exits. Additionally, can not continue installing more + // that already exists. Additionally, can not continue installing more // modules because those may depend on the current module being installed. $existing_configuration = $this->findPreExistingConfiguration(); if (!empty($existing_configuration)) { @@ -587,9 +586,9 @@ protected function drupalGetPath($type, $name) { * Wrapper for drupal_get_profile(). * * @return string|null $profile - * The name of the installation profile or NULL if no installation profile is - * currently active. This is the case for example during the first steps of - * the installer or during unit tests. + * The name of the installation profile or NULL if no installation profile + * is currently active. This is the case for example during the first steps + * of the installer or during unit tests. */ protected function drupalGetProfile() { return drupal_get_profile(); diff --git a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php index e49dfe7..bd2dad7 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php +++ b/core/lib/Drupal/Core/Config/ConfigInstallerInterface.php @@ -70,13 +70,6 @@ public function installCollectionDefaultConfig($collection); public function setSourceStorage(StorageInterface $storage); /** - * Resets the configuration storage that provides the default configuration. - * - * @return $this - */ - public function resetSourceStorage(); - - /** * Sets the status of the isSyncing flag. * * @param bool $status diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index af2ab64..378dc3c 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -242,12 +242,6 @@ public function install(array $module_list, $enable_dependencies = TRUE) { ->setSyncing(TRUE) ->setSourceStorage($source_storage); } - else { - // If we're not in a config synchronization reset the source storage - // so that the extension install storage will pick up the new - // configuration. - $config_installer->resetSourceStorage(); - } \Drupal::service('config.installer')->installDefaultConfig('module', $module); // If the module has no current updates, but has some that were diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index 79ca84c..a493550 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -285,16 +285,6 @@ public function install(array $theme_list, $install_dependencies = TRUE) { // Only install default configuration if this theme has not been installed // already. if (!isset($installed_themes[$key])) { - // The default config installation storage only knows about the - // currently installed list of themes, so it has to be reset in order to - // pick up the default config of the newly installed theme. However, do - // not reset the source storage when synchronizing configuration, since - // that would needlessly trigger a reload of the whole configuration to - // be imported. - if (!$this->configInstaller->isSyncing()) { - $this->configInstaller->resetSourceStorage(); - } - // Install default configuration of the theme. $this->configInstaller->installDefaultConfig('theme', $key); } diff --git a/core/modules/config/src/Tests/ConfigImportRecreateTest.php b/core/modules/config/src/Tests/ConfigImportRecreateTest.php index 1c0166d..a8a18bc 100644 --- a/core/modules/config/src/Tests/ConfigImportRecreateTest.php +++ b/core/modules/config/src/Tests/ConfigImportRecreateTest.php @@ -93,8 +93,8 @@ public function testRecreateEntity() { // will be recreated. $creates = $this->configImporter->getUnprocessedConfiguration('create'); $deletes = $this->configImporter->getUnprocessedConfiguration('delete'); - $this->assertEqual(5, count($creates), 'There are 4 configuration items to create.'); - $this->assertEqual(5, count($deletes), 'There are 4 configuration items to delete.'); + $this->assertEqual(5, count($creates), 'There are 5 configuration items to create.'); + $this->assertEqual(5, count($deletes), 'There are 5 configuration items to delete.'); $this->assertEqual(0, count($this->configImporter->getUnprocessedConfiguration('update')), 'There are no configuration items to update.'); $this->assertIdentical($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.'); diff --git a/core/modules/views/src/Tests/ViewExecutableTest.php b/core/modules/views/src/Tests/ViewExecutableTest.php index 6affac2..07ece1b 100644 --- a/core/modules/views/src/Tests/ViewExecutableTest.php +++ b/core/modules/views/src/Tests/ViewExecutableTest.php @@ -85,7 +85,8 @@ protected function setUpFixtures() { $this->installEntitySchema('comment'); $this->installSchema('comment', array('comment_entity_statistics')); $this->installConfig(array('system', 'field', 'node', 'comment')); - // Clear the views data cache so it updated with the new entity information. + // Clear the views data cache so it's updated with the new entity + // information. \Drupal::service('views.views_data')->clear(); entity_create('node_type', array(