diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 6fe1afa..adfc2b1 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -9,6 +9,7 @@ use Drupal\Component\Utility\Unicode; use Drupal\Core\Config\Entity\ConfigDependencyManager; +use Drupal\Core\Site\Settings; use Symfony\Component\EventDispatcher\EventDispatcherInterface; class ConfigInstaller implements ConfigInstallerInterface { @@ -105,8 +106,16 @@ public function installDefaultConfig($type, $name) { // Read enabled extensions directly from configuration to avoid circular // dependencies with ModuleHandler and ThemeHandler. $extension_config = $this->configFactory->get('core.extension'); - $enabled_extensions = array_keys((array) $extension_config->get('module')); + $modules = (array) $extension_config->get('module'); + // Unless we installing the profile remove it. + if ($install_profile = Settings::get('install_profile')) { + if ($name !== $install_profile) { + unset($modules[$install_profile]); + } + } + $enabled_extensions = array_keys($modules); $enabled_extensions += array_keys((array) $extension_config->get('theme')); + // Core can provide configuration. $enabled_extensions[] = 'core'; @@ -284,8 +293,9 @@ public function resetSourceStorage() { public function getSourceStorage($collection = StorageInterface::DEFAULT_COLLECTION) { if (!isset($this->sourceStorage)) { // Default to using the ExtensionInstallStorage which searches extension's - // config directories for default configuration. - $this->sourceStorage = new ExtensionInstallStorage($this->activeStorage, InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection); + // config directories for default configuration. Only include the profile + // configuration during Drupal installation. + $this->sourceStorage = new ExtensionInstallStorage($this->activeStorage, InstallStorage::CONFIG_INSTALL_DIRECTORY, $collection, drupal_installation_attempted()); } if ($this->sourceStorage->getCollectionName() != $collection) { $this->sourceStorage = $this->sourceStorage->createCollection($collection); diff --git a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php index 81871a7..cb2833e 100644 --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -7,6 +7,8 @@ namespace Drupal\Core\Config; +use Drupal\Core\Site\Settings; + /** * Storage to access configuration and schema in enabled extensions. * @@ -23,6 +25,13 @@ class ExtensionInstallStorage extends InstallStorage { protected $configStorage; /** + * Flag to include the profile in the list of enabled modules. + * + * @var bool + */ + protected $includeProfile = TRUE; + + /** * Overrides \Drupal\Core\Config\InstallStorage::__construct(). * * @param \Drupal\Core\Config\StorageInterface $config_storage @@ -34,11 +43,15 @@ class ExtensionInstallStorage extends InstallStorage { * @param string $collection * (optional) The collection to store configuration in. Defaults to the * default collection. + * @param bool $include_profile + * (optional) Whether to include the install profile in extensions to + * search. */ - public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION) { + public function __construct(StorageInterface $config_storage, $directory = self::CONFIG_INSTALL_DIRECTORY, $collection = StorageInterface::DEFAULT_COLLECTION, $include_profile = TRUE) { $this->configStorage = $config_storage; $this->directory = $directory; $this->collection = $collection; + $this->includeProfile = $include_profile; } /** @@ -71,7 +84,13 @@ protected function getAllFolders() { $extensions = $this->configStorage->read('core.extension'); if (!empty($extensions['module'])) { - $this->folders += $this->getComponentNames('module', array_keys($extensions['module'])); + $modules = $extensions['module']; + if (!$this->includeProfile) { + if ($install_profile = Settings::get('install_profile')) { + unset($modules[$install_profile]); + } + } + $this->folders += $this->getComponentNames('module', array_keys($modules)); } if (!empty($extensions['theme'])) { $this->folders += $this->getComponentNames('theme', array_keys($extensions['theme'])); diff --git a/core/profiles/standard/src/Tests/StandardTest.php b/core/profiles/standard/src/Tests/StandardTest.php index 9977e64..b05285e 100644 --- a/core/profiles/standard/src/Tests/StandardTest.php +++ b/core/profiles/standard/src/Tests/StandardTest.php @@ -100,6 +100,18 @@ function testStandard() { $config = $factory->get($name); $this->assertConfigSchema($typed_config, $name, $config->get()); } + + // Ensure that configuration from the Standard profile is not reused when + // enabling a module again since it contains configuration that can not be + // installed. For example, editor.editor.basic_html is editor configuration + // that depends on the ckeditor module. The ckeditor module can not be + // installed before the editor module since it depends on the editor module. + // The installer does not have this limitation since it ensures that all of + // the install profiles dependencies are installed before creating the + // editor configuration. + \Drupal::moduleHandler()->uninstall(array('editor', 'ckeditor')); + $this->rebuildContainer(); + \Drupal::moduleHandler()->install(array('editor')); } }