diff --git a/core/config/core.extension.yml b/core/config/core.extension.yml new file mode 100644 index 0000000000000000000000000000000000000000..eae39efffbc37899e447adbbf1beefead5789f4b --- /dev/null +++ b/core/config/core.extension.yml @@ -0,0 +1,5 @@ +module: {} +theme: + stark: 0 +disabled: + theme: {} diff --git a/core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml similarity index 100% rename from core/lib/Drupal/Core/Config/Schema/core.data_types.schema.yml rename to core/config/schema/core.data_types.schema.yml diff --git a/core/config/schema/core.extension.schema.yml b/core/config/schema/core.extension.schema.yml new file mode 100644 index 0000000000000000000000000000000000000000..3b93d9297cebbd609acddbb747b46a99b0cae27d --- /dev/null +++ b/core/config/schema/core.extension.schema.yml @@ -0,0 +1,26 @@ +core.extension: + type: mapping + label: 'Extension settings' + mapping: + module: + type: sequence + label: 'Enabled modules' + sequence: + - type: integer + label: 'Weight' + theme: + type: sequence + label: 'Enabled themes' + sequence: + - type: integer + label: 'Weight' + disabled: + type: mapping + label: 'Disabled extensions' + mapping: + theme: + type: sequence + label: 'Disabled themes' + sequence: + - type: integer + label: 'Weight' diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index a704ebff5ff4c0871e2082b2086970257b181285..36a0627af8d8078ed0ce2363ff83956e836c40ed 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -560,9 +560,11 @@ function _drupal_request_initialize() { * the above, depending on where the module is located. * * @param $type - * The type of the item (theme, theme_engine, module, profile). + * The type of the item; one of 'core', 'profile', 'module', 'theme', or + * 'theme_engine'. * @param $name - * The name of the item for which the filename is requested. + * The name of the item for which the filename is requested. Ignored for + * $type 'core'. * @param $filename * The filename of the item if it is to be set explicitly rather * than by consulting the database. @@ -575,6 +577,14 @@ function drupal_get_filename($type, $name, $filename = NULL) { // drupal_static(). static $files = array(); + // Type 'core' only exists to simplify application-level logic; it always maps + // to the /core directory, whereas $name is ignored. It is only requested via + // drupal_get_path(). /core/core.info.yml does not exist, but is required + // since drupal_get_path() returns the dirname() of the returned pathname. + if ($type === 'core') { + return 'core/core.info.yml'; + } + // Profiles are converted into modules in system_rebuild_module_data(). // @todo Remove false-exposure of profiles as modules. $original_type = $type; diff --git a/core/includes/common.inc b/core/includes/common.inc index 44cafd148ac4687140c05c981bed3f37ad7ef07d..f2a2b4c5cfa15d2c90425b5375794d691e90ba54 100644 --- a/core/includes/common.inc +++ b/core/includes/common.inc @@ -1228,9 +1228,11 @@ function drupal_set_time_limit($time_limit) { * Returns the path to a system item (module, theme, etc.). * * @param $type - * The type of the item (i.e. theme, theme_engine, module, profile). + * The type of the item; one of 'core', 'profile', 'module', 'theme', or + * 'theme_engine'. * @param $name - * The name of the item for which the path is requested. + * The name of the item for which the path is requested. Ignored for + * $type 'core'. * * @return * The path to the requested item or an empty string if the item is not found. diff --git a/core/includes/install.inc b/core/includes/install.inc index e7e520676e7feb07b1dbe10f8558119c85c2da51..5c9dcf90871fdda04ec6dbc6e35ab77ee66035d5 100644 --- a/core/includes/install.inc +++ b/core/includes/install.inc @@ -633,10 +633,7 @@ function drupal_verify_profile($install_state) { * to set the default language. */ function drupal_install_system($install_state) { - // Create tables. - drupal_install_schema('system'); - - // Immediately boot a new kernel into the regular production environment. + // Boot a new kernel into a regular production environment. $request = \Drupal::hasRequest() ? \Drupal::request() : FALSE; unset($GLOBALS['conf']['container_service_providers']['InstallerServiceProvider']); @@ -649,32 +646,11 @@ function drupal_install_system($install_state) { $kernel->getContainer()->get('request_stack')->push($request); } - $system_path = drupal_get_path('module', 'system'); - require_once DRUPAL_ROOT . '/' . $system_path . '/system.install'; - - // Set the schema version to the number of the last update provided by the - // module, or the minimum core schema version. - $system_version = \Drupal::CORE_MINIMUM_SCHEMA_VERSION; - $system_versions = drupal_get_schema_versions('system'); - if ($system_versions) { - $system_version = max(max($system_versions), $system_version); - } - \Drupal::keyValue('system.schema')->set('system', $system_version); - - // System module needs to be enabled and the system/module lists need to be - // reset first in order to allow installation of default configuration to - // invoke config import callbacks. - // @todo Installation profiles may override the system.module config object. - \Drupal::config('system.module') - ->set('enabled.system', 0) - ->save(); - - // Update the module list to include it. Reboot the kernel too. - \Drupal::moduleHandler()->addModule('system', 'core/modules/system'); - $module_list = \Drupal::moduleHandler()->getModuleList(); - $kernel->updateModules($module_list); + // Install base system configuration. + \Drupal::service('config.installer')->installDefaultConfig('core', 'core'); - \Drupal::service('config.installer')->installDefaultConfig('module', 'system'); + // Install System module. + \Drupal::moduleHandler()->install(array('system'), FALSE); // Ensure default language is saved. if (isset($install_state['parameters']['langcode'])) { @@ -682,8 +658,6 @@ function drupal_install_system($install_state) { ->set('langcode', $install_state['parameters']['langcode']) ->save(); } - - \Drupal::moduleHandler()->invoke('system', 'install'); } /** diff --git a/core/includes/module.inc b/core/includes/module.inc index 7bb0e3e0e2804205309d31fe6c2ab27a1723d7fa..b5d189cc4a2982e8133ff52f05938fec55acde3e 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -41,7 +41,7 @@ function system_list($type) { 'filepaths' => array(), ); // Build a list of themes. - $enabled_themes = (array) \Drupal::config('system.theme')->get('enabled'); + $enabled_themes = \Drupal::config('core.extension')->get('theme') ?: array(); // @todo Themes include all themes, including disabled/uninstalled. This // system.theme.data state will go away entirely as soon as themes have // a proper installation status. @@ -305,11 +305,11 @@ function drupal_required_modules() { */ function module_set_weight($module, $weight) { // Update the module weight in the config file that contains it. - $module_config = \Drupal::config('system.module'); - if ($module_config->get("enabled.$module") !== NULL) { - $module_config - ->set("enabled.$module", $weight) - ->set('enabled', module_config_sort($module_config->get('enabled'))) + $extension_config = \Drupal::config('core.extension'); + if ($extension_config->get("module.$module") !== NULL) { + $extension_config + ->set("module.$module", $weight) + ->set('module', module_config_sort($extension_config->get('module'))) ->save(); // Prepare the new module list, sorted by weight, including filenames. @@ -317,7 +317,7 @@ function module_set_weight($module, $weight) { $module_handler = \Drupal::moduleHandler(); $current_module_filenames = $module_handler->getModuleList(); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0); - $current_modules = module_config_sort(array_merge($current_modules, $module_config->get('enabled'))); + $current_modules = module_config_sort(array_merge($current_modules, $extension_config->get('module'))); $module_filenames = array(); foreach ($current_modules as $name => $weight) { $module_filenames[$name] = $current_module_filenames[$name]; diff --git a/core/includes/update.inc b/core/includes/update.inc index 9aa35bfd6df7934963dd99e5e68aad45fb9c4229..fd02de09ada0decbf200b1aef925da70a489bc66 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -23,21 +23,22 @@ * Disables any extensions that are incompatible with the current core version. */ function update_fix_compatibility() { + $extension_config = \Drupal::config('core.extension'); + $save = FALSE; foreach (array('module', 'theme') as $type) { - $config = \Drupal::config("system.$type"); - $save = FALSE; - foreach ($config->get('enabled') as $name => $weight) { + foreach ($extension_config->get($type) as $name => $weight) { if (update_check_incompatibility($name, $type)) { - $config->clear("enabled.$name"); + $extension_config->clear("$type.$name"); + if ($type === 'theme') { + $extension_config->set("disabled.theme.$name", 0); + } $save = TRUE; } } - if ($save) { - if ($type == 'module') { - $config->set('enabled', module_config_sort($config->get('enabled'))); - } - $config->save(); - } + } + if ($save) { + $extension_config->set('module', module_config_sort($extension_config->get('module'))); + $extension_config->save(); } } diff --git a/core/lib/Drupal/Core/Config/ConfigInstaller.php b/core/lib/Drupal/Core/Config/ConfigInstaller.php index 3769a7b48bd9e463155eec32b86c90c597a347bb..038dbd63b84e1730db932cee0677b28578cd8dae 100644 --- a/core/lib/Drupal/Core/Config/ConfigInstaller.php +++ b/core/lib/Drupal/Core/Config/ConfigInstaller.php @@ -87,22 +87,27 @@ public function installDefaultConfig($type, $name) { // extension has a configuration schema directory. $this->typedConfig->clearCachedDefinitions(); } - $default_storage = new FileStorage($config_dir); - $other_module_config = array_filter($default_storage->listAll(), function ($value) use ($name) { - return !preg_match('/^' . $name . '\./', $value); - }); - - // Read enabled extensions directly from configuration to avoid circular - // dependencies with ModuleHandler and ThemeHandler. - $enabled_extensions = array_keys((array) $this->configFactory->get('system.module')->get('enabled')); - $enabled_extensions += array_keys((array) $this->configFactory->get('system.theme')->get('enabled')); - - $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { - $provider = Unicode::substr($config_name, 0, strpos($config_name, '.')); - return in_array($provider, $enabled_extensions); - }); - - $config_to_install = array_merge($config_to_install, $other_module_config); + // If not installing the core base system default configuration, retrieve + // the list of integration configuration of currently enabled extensions. + if ($type !== 'core') { + $default_storage = new FileStorage($config_dir); + $other_module_config = array_filter($default_storage->listAll(), function ($value) use ($name) { + return !preg_match('/^' . $name . '\./', $value); + }); + $enabled_extensions = array(); + // 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')); + $enabled_extensions += array_keys((array) $extension_config->get('theme')); + + $other_module_config = array_filter($other_module_config, function ($config_name) use ($enabled_extensions) { + $provider = Unicode::substr($config_name, 0, strpos($config_name, '.')); + return in_array($provider, $enabled_extensions); + }); + + $config_to_install = array_merge($config_to_install, $other_module_config); + } } if (!empty($config_to_install)) { diff --git a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php index 60f418893d0578a75f9050443de3b674c31827e1..efaef9539df8253303ee15dca5659f4e48880a27 100644 --- a/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php +++ b/core/lib/Drupal/Core/Config/ExtensionInstallStorage.php @@ -55,13 +55,14 @@ public function reset() { protected function getAllFolders() { if (!isset($this->folders)) { $this->folders = array(); - $modules = $this->configStorage->read('system.module'); - if (isset($modules['enabled'])) { - $this->folders += $this->getComponentNames('module', array_keys($modules['enabled'])); + $this->folders += $this->getComponentNames('core', array('core')); + + $extensions = $this->configStorage->read('core.extension'); + if (!empty($extensions['module'])) { + $this->folders += $this->getComponentNames('module', array_keys($extensions['module'])); } - $themes = $this->configStorage->read('system.theme'); - if (isset($themes['enabled'])) { - $this->folders += $this->getComponentNames('theme', array_keys($themes['enabled'])); + if (!empty($extensions['theme'])) { + $this->folders += $this->getComponentNames('theme', array_keys($extensions['theme'])); } // The install profile can override module default configuration. We do diff --git a/core/lib/Drupal/Core/Config/InstallStorage.php b/core/lib/Drupal/Core/Config/InstallStorage.php index eba75410f7d6ba73447e82b39ac3e7f2d19daff9..124748a9068a3c82875e26a1d542012917d6eff2 100644 --- a/core/lib/Drupal/Core/Config/InstallStorage.php +++ b/core/lib/Drupal/Core/Config/InstallStorage.php @@ -119,6 +119,7 @@ public function listAll($prefix = '') { protected function getAllFolders() { if (!isset($this->folders)) { $this->folders = array(); + $this->folders += $this->getComponentNames('core', array('core')); // @todo Refactor getComponentNames() to use the extension list directly. if ($profile = drupal_get_profile()) { $this->folders += $this->getComponentNames('profile', array($profile)); diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaStorage.php b/core/lib/Drupal/Core/Config/Schema/SchemaStorage.php index 1b84dece02e10c63bbccf4262614164c1dd7ac21..b58d1f66a51dbdbc71cfaca4fe8b420d0f56bee4 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaStorage.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaStorage.php @@ -56,32 +56,4 @@ public function rename($name, $new_name) { throw new StorageException('Rename operation is not allowed for config schema storage.'); } - /** - * Returns a map of all config object names and their folders. - * - * The list is based on enabled modules and themes. - * - * @return array - * An array mapping config object names with directories. - */ - protected function getAllFolders() { - if (!isset($this->folders)) { - parent::getAllFolders(); - $this->folders += $this->getBaseDataTypeSchema(); - } - return $this->folders; - } - - /** - * Gets the base data types for configuration schema. - * - * @return array - * The file containing the base data types for configuration schema. - */ - protected function getBaseDataTypeSchema() { - return array( - 'core.data_types.schema' => 'core/lib/Drupal/Core/Config/Schema' - ); - } - } diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php index 8172b480da207b567cf413362a933004da90ef90..0893073fcfd51aebaf2adbbf0707b767b0fb99eb 100644 --- a/core/lib/Drupal/Core/DrupalKernel.php +++ b/core/lib/Drupal/Core/DrupalKernel.php @@ -214,8 +214,8 @@ public function discoverServiceProviders() { // Ensure we know what modules are enabled and that their namespaces are // registered. if (!isset($this->moduleList)) { - $module_list = $this->getConfigStorage()->read('system.module'); - $this->moduleList = isset($module_list['enabled']) ? $module_list['enabled'] : array(); + $extensions = $this->getConfigStorage()->read('core.extension'); + $this->moduleList = isset($extensions['module']) ? $extensions['module'] : array(); } $module_filenames = $this->getModuleFileNames(); $this->registerNamespaces($this->getModuleNamespaces($module_filenames)); @@ -414,7 +414,7 @@ protected function initializeContainer() { // If 'container.modules' is wrong, the container must be rebuilt. if (!isset($this->moduleList)) { - $this->moduleList = $this->container->get('config.factory')->get('system.module')->get('enabled'); + $this->moduleList = $this->container->get('config.factory')->get('core.extension')->get('module') ?: array(); } if (array_keys($this->moduleList) !== array_keys($container_modules)) { $persist = $this->getServicesToPersist(); diff --git a/core/lib/Drupal/Core/Extension/ModuleHandler.php b/core/lib/Drupal/Core/Extension/ModuleHandler.php index a20b9b982d08012a8c27ffb7449c457513635ba0..17b4239b0cb48cfed7315ddabf27d9f632c383b2 100644 --- a/core/lib/Drupal/Core/Extension/ModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/ModuleHandler.php @@ -533,7 +533,7 @@ public static function parseDependency($dependency) { * {@inheritdoc} */ public function install(array $module_list, $enable_dependencies = TRUE) { - $module_config = \Drupal::config('system.module'); + $extension_config = \Drupal::config('core.extension'); if ($enable_dependencies) { // Get all module data so we can find dependencies and sort. $module_data = system_rebuild_module_data(); @@ -544,7 +544,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } // Only process currently uninstalled modules. - $installed_modules = $module_config->get('enabled') ?: array(); + $installed_modules = $extension_config->get('module') ?: array(); if (!$module_list = array_diff_key($module_list, $installed_modules)) { // Nothing to do. All modules already installed. return TRUE; @@ -584,7 +584,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { $modules_installed = array(); foreach ($module_list as $module) { - $enabled = $module_config->get("enabled.$module") !== NULL; + $enabled = $extension_config->get("module.$module") !== NULL; if (!$enabled) { // Throw an exception if the module name is too long. if (strlen($module) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { @@ -594,9 +594,9 @@ public function install(array $module_list, $enable_dependencies = TRUE) { ))); } - $module_config - ->set("enabled.$module", 0) - ->set('enabled', module_config_sort($module_config->get('enabled'))) + $extension_config + ->set("module.$module", 0) + ->set('module', module_config_sort($extension_config->get('module'))) ->save(); // Prepare the new module list, sorted by weight, including filenames. @@ -610,7 +610,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // contained in the configured enabled modules, we assume a weight of 0. $current_module_filenames = $this->getModuleList(); $current_modules = array_fill_keys(array_keys($current_module_filenames), 0); - $current_modules = module_config_sort(array_merge($current_modules, $module_config->get('enabled'))); + $current_modules = module_config_sort(array_merge($current_modules, $extension_config->get('module'))); $module_filenames = array(); foreach ($current_modules as $name => $weight) { if (isset($current_module_filenames[$name])) { @@ -712,8 +712,8 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { } // Only process currently installed modules. - $module_config = \Drupal::config('system.module'); - $installed_modules = $module_config->get('enabled') ?: array(); + $extension_config = \Drupal::config('core.extension'); + $installed_modules = $extension_config->get('module') ?: array(); if (!$module_list = array_intersect_key($module_list, $installed_modules)) { // Nothing to do. All modules already uninstalled. return TRUE; @@ -767,7 +767,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { drupal_uninstall_schema($module); // Remove the module's entry from the config. - $module_config->clear("enabled.$module")->save(); + $extension_config->clear("module.$module")->save(); // Update the module handler to remove the module. // The current ModuleHandler instance is obsolete with the kernel rebuild diff --git a/core/lib/Drupal/Core/Extension/ThemeHandler.php b/core/lib/Drupal/Core/Extension/ThemeHandler.php index ba658c2ecde39d8f0b17272c892e12f68c9badbc..1474102fc018788201f8699bbc5871ee85a187cd 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -127,8 +127,7 @@ public function __construct(ConfigFactoryInterface $config_factory, ModuleHandle */ public function enable(array $theme_list) { $this->clearCssCache(); - $theme_config = $this->configFactory->get('system.theme'); - $disabled_themes = $this->configFactory->get('system.theme.disabled'); + $extension_config = $this->configFactory->get('core.extension'); foreach ($theme_list as $key) { // Throw an exception if the theme name is too long. if (strlen($key) > DRUPAL_EXTENSION_NAME_MAX_LENGTH) { @@ -139,8 +138,10 @@ public function enable(array $theme_list) { } // The value is not used; the weight is ignored for themes currently. - $theme_config->set("enabled.$key", 0)->save(); - $disabled_themes->clear($key)->save(); + $extension_config + ->set("theme.$key", 0) + ->clear("disabled.theme.$key") + ->save(); // Refresh the theme list as installation of default configuration needs // an updated list to work. @@ -160,8 +161,9 @@ public function enable(array $theme_list) { */ public function disable(array $theme_list) { // Don't disable the default or admin themes. - $default_theme = \Drupal::config('system.theme')->get('default'); - $admin_theme = \Drupal::config('system.theme')->get('admin'); + $theme_config = $this->configFactory->get('system.theme'); + $default_theme = $theme_config->get('default'); + $admin_theme = $theme_config->get('admin'); $theme_list = array_diff($theme_list, array($default_theme, $admin_theme)); if (empty($theme_list)) { return; @@ -169,15 +171,14 @@ public function disable(array $theme_list) { $this->clearCssCache(); - $theme_config = $this->configFactory->get('system.theme'); - $disabled_themes = $this->configFactory->get('system.theme.disabled'); + $extension_config = $this->configFactory->get('core.extension'); foreach ($theme_list as $key) { // The value is not used; the weight is ignored for themes currently. - $theme_config->clear("enabled.$key"); - $disabled_themes->set($key, 0); + $extension_config + ->clear("theme.$key") + ->set("disabled.theme.$key", 0); } - $theme_config->save(); - $disabled_themes->save(); + $extension_config->save(); $this->reset(); $this->resetSystem(); diff --git a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php index 4327aacdc3793d06d899a0546b511c2a58cb5105..42fbd2a758a7a2c5797e5592018de82211295f5b 100644 --- a/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php +++ b/core/lib/Drupal/Core/Extension/UpdateModuleHandler.php @@ -80,10 +80,10 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } // Enable the module with a weight of 0. - $module_config = \Drupal::config('system.module'); - $module_config - ->set("enabled.$module", 0) - ->set('enabled', module_config_sort($module_config->get('enabled'))) + $extension_config = \Drupal::config('core.extension'); + $extension_config + ->set("module.$module", 0) + ->set('module', module_config_sort($extension_config->get('module'))) ->save(); $current_schema = $schema_store->get($module); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php index 7188744fbec7d9dd701c8011e065d9743a117097..f2a10f3bd187ebe7dab142afa98a3105fdb30950 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigInstallTest.php @@ -75,7 +75,7 @@ function testModuleInstallation() { $this->assertIdentical($config->get('integer'), 1); // Test that uninstalling configuration removes configuration schema. - \Drupal::config('system.module')->set('enabled', array())->save(); + \Drupal::config('core.extension')->set('module', array())->save(); \Drupal::service('config.manager')->uninstall('module', 'config_test'); $this->assertFalse(\Drupal::service('config.typed')->hasConfigSchema('config_test.schema_in_install'), 'Configuration schema for config_test.schema_in_install does not exist.'); diff --git a/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php b/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php index 6a99605b458199fde33f5b5fe0baf6aa7a546659..d430bd388d46b22ce93c47c8a87832ca49e197c6 100644 --- a/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/Storage/FileStorageTest.php @@ -53,7 +53,7 @@ protected function delete($name) { */ protected function testlistAll() { $expected_files = array( - 'system.module', + 'core.extension', 'system.performance', ); diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php index cefb13fd37e939ca9bdb25d37b1a5740f69e6fc3..f85de95ba63fdcf65d3a1cff4ba99a882d6429b8 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestInstallStorage.php @@ -23,11 +23,11 @@ class TestInstallStorage extends InstallStorage { */ protected function getAllFolders() { if (!isset($this->folders)) { + $this->folders = $this->getComponentNames('core', array('core')); // @todo Refactor getComponentNames() to use the extension list directly. $listing = new ExtensionDiscovery(); - // Test all profiles. $listing->setProfileDirectories(array()); - $this->folders = $this->getComponentNames('profile', array_keys($listing->scan('profile'))); + $this->folders += $this->getComponentNames('profile', array_keys($listing->scan('profile'))); $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module'))); $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('theme'))); } diff --git a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php index 34b864241e27f9128c4e7ece4b300518ed524aa1..dd782a915695bbe8975a28d2856f8bc7e7c8b5e2 100644 --- a/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php +++ b/core/modules/config/tests/config_test/lib/Drupal/config_test/TestSchemaStorage.php @@ -30,9 +30,10 @@ public function __construct() { */ protected function getAllFolders() { if (!isset($this->folders)) { + $this->folders = $this->getComponentNames('core', array('core')); // @todo Refactor getComponentNames() to use the extension list directly. $listing = new ExtensionDiscovery(); - $this->folders = $this->getBaseDataTypeSchema(); + $listing->setProfileDirectories(array()); $this->folders += $this->getComponentNames('profile', array_keys($listing->scan('profile'))); $this->folders += $this->getComponentNames('module', array_keys($listing->scan('module'))); $this->folders += $this->getComponentNames('theme', array_keys($listing->scan('theme'))); diff --git a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php index 7737cc897ca96be1fd8bdc5eadae3f7a4af68018..a50a2d485ca1aa6fd45e9325e72aa92c734976b9 100644 --- a/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php +++ b/core/modules/simpletest/lib/Drupal/simpletest/DrupalUnitTestBase.php @@ -143,12 +143,12 @@ protected function setUp() { $this->kernel = new DrupalKernel('unit_testing', drupal_classloader(), FALSE); $this->kernel->boot(); - // Create a minimal system.module configuration object so that the list of + // Create a minimal core.extension configuration object so that the list of // enabled modules can be maintained allowing // \Drupal\Core\Config\ConfigInstaller::installDefaultConfig() to work. // Write directly to active storage to avoid early instantiation of // the event dispatcher which can prevent modules from registering events. - \Drupal::service('config.storage')->write('system.module', array('enabled' => array())); + \Drupal::service('config.storage')->write('core.extension', array('module' => array())); // Collect and set a fixed module list. $class = get_class($this); @@ -346,14 +346,14 @@ protected function enableModules(array $modules) { // Write directly to active storage to avoid early instantiation of // the event dispatcher which can prevent modules from registering events. $active_storage = \Drupal::service('config.storage'); - $system_config = $active_storage->read('system.module'); + $extensions = $active_storage->read('core.extension'); foreach ($modules as $module) { $module_handler->addModule($module, drupal_get_path('module', $module)); // Maintain the list of enabled modules in configuration. - $system_config['enabled'][$module] = 0; + $extensions['module'][$module] = 0; } - $active_storage->write('system.module', $system_config); + $active_storage->write('core.extension', $extensions); // Update the kernel to make their services available. $module_filenames = $module_handler->getModuleList(); @@ -382,12 +382,12 @@ protected function disableModules(array $modules) { // Unset the list of modules in the extension handler. $module_handler = $this->container->get('module_handler'); $module_filenames = $module_handler->getModuleList(); - $system_config = $this->container->get('config.factory')->get('system.module'); + $extension_config = $this->container->get('config.factory')->get('core.extension'); foreach ($modules as $module) { unset($module_filenames[$module]); - $system_config->clear('enabled.' . $module); + $extension_config->clear('module.' . $module); } - $system_config->save(); + $extension_config->save(); $module_handler->setModuleList($module_filenames); $module_handler->resetImplementations(); // Update the kernel to remove their services. diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index 3a14c5c9caa96cde478982be4616fdeafa6c00a6..5f8b4d47bb598ab26f00deb5b4d3df24098def43 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -274,12 +274,6 @@ system.theme: admin: type: string label: 'Administration theme' - enabled: - type: sequence - label: 'Enabled themes' - sequence: - - type: integer - label: 'Weight' default: type: string label: 'Default theme' @@ -390,17 +384,6 @@ system.mail: type: string label: 'Default' -system.module: - type: mapping - label: 'Module settings' - mapping: - enabled: - type: sequence - label: 'Enabled modules' - sequence: - - type: integer - label: 'Weight' - system.theme.global: type: mapping label: 'Theme global settings' @@ -465,10 +448,3 @@ system.theme.global: use_default: type: boolean label: 'Use default' - -system.theme.disabled: - type: sequence - label: 'Disabled themes' - sequence: - - type: integer - label: 'Weight' diff --git a/core/modules/system/config/system.module.yml b/core/modules/system/config/system.module.yml deleted file mode 100644 index 9ec80e11f4d23e10408bc11cdad37980f2e971a8..0000000000000000000000000000000000000000 --- a/core/modules/system/config/system.module.yml +++ /dev/null @@ -1,2 +0,0 @@ -enabled: - system: 0 diff --git a/core/modules/system/config/system.theme.yml b/core/modules/system/config/system.theme.yml index e88d7013b100831c33bd6b03715da4b4275a7bc6..988dc489d439bca3eb95e79407ed9f4cf1adeca7 100644 --- a/core/modules/system/config/system.theme.yml +++ b/core/modules/system/config/system.theme.yml @@ -1,4 +1,2 @@ admin: '' -enabled: - stark: 0 default: stark diff --git a/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php index eaa2fc912ee06b6526a06ea6581564d568e0e58c..bcaced050f78d9a616aa6b88cf01055ec534f23e 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Module/InstallTest.php @@ -48,7 +48,7 @@ public function testGetSchemaAtInstallTime() { */ public function testEnableUserTwice() { \Drupal::moduleHandler()->install(array('user'), FALSE); - $this->assertIdentical(\Drupal::config('system.module')->get('enabled.user'), 0); + $this->assertIdentical(\Drupal::config('core.extension')->get('module.user'), 0); } /** diff --git a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php index 463b4868879804a18424d6cc4e61c65c83bbca60..cd921911038102d12fcef183b2eed48fc35fbb37 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Update/UpdateScriptTest.php @@ -152,10 +152,10 @@ function testThemeSystem() { // Since visiting update.php triggers a rebuild of the theme system from an // unusual maintenance mode environment, we check that this rebuild did not // put any incorrect information about the themes into the database. - $original_theme_data = \Drupal::config('system.theme')->get('enabled'); + $original_theme_data = \Drupal::config('core.extension')->get('theme'); $this->drupalLogin($this->update_user); $this->drupalGet($this->update_url, array('external' => TRUE)); - $final_theme_data = \Drupal::config('system.theme')->get('enabled'); + $final_theme_data = \Drupal::config('core.extension')->get('theme'); $this->assertEqual($original_theme_data, $final_theme_data, 'Visiting update.php does not alter the information about themes stored in the database.'); } diff --git a/core/modules/system/system.module b/core/modules/system/system.module index 7b35fca5ec8e0f06dbfba6812ad62ed63c0b8d6a..3cb4d65aa8d9a83f490c1500c5765495905c98e7 100644 --- a/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -1287,7 +1287,7 @@ function system_rebuild_module_data() { $files = array(); ksort($modules); // Add status, weight, and schema version. - $installed_modules = (array) \Drupal::config('system.module')->get('enabled'); + $installed_modules = \Drupal::config('core.extension')->get('module') ?: array(); foreach ($modules as $name => $module) { $module->weight = isset($installed_modules[$name]) ? $installed_modules[$name] : 0; $module->status = (int) isset($installed_modules[$name]); @@ -1335,7 +1335,7 @@ function system_rebuild_theme_data() { // based on the current config. Remove this code when themes have a proper // installation status. // @see http://drupal.org/node/1067408 - $enabled_themes = (array) \Drupal::config('system.theme')->get('enabled'); + $enabled_themes = \Drupal::config('core.extension')->get('theme') ?: array(); $files = array(); foreach ($themes as $name => $theme) { $theme->status = (int) isset($enabled_themes[$name]); diff --git a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php index a18409254e15474d33c7897279338a994415b8f3..25d8233a4309c12340b4277c994b01cd2b3cc017 100644 --- a/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php +++ b/core/modules/update/lib/Drupal/update/Tests/UpdateContribTest.php @@ -206,13 +206,13 @@ function testUpdateBaseThemeSecurityUpdate() { function testUpdateShowDisabledThemes() { $update_settings = \Drupal::config('update.settings'); // Make sure all the update_test_* themes are disabled. - $theme_config = \Drupal::config('system.theme'); - foreach ($theme_config->get('enabled') as $theme => $weight) { + $extension_config = \Drupal::config('core.extension'); + foreach ($extension_config->get('theme') as $theme => $weight) { if (preg_match('/^update_test_/', $theme)) { - $theme_config->clear("enabled.$theme"); + $extension_config->clear("theme.$theme"); } } - $theme_config->save(); + $extension_config->save(); // Define the initial state for core and the test contrib themes. $system_info = array( diff --git a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php index 6ba25396bd2652c7d2a5866ef2c8bed2e1e4dc46..3864923346338d760a22acd4048c43a4ca5fb051 100644 --- a/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php +++ b/core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php @@ -94,7 +94,15 @@ public static function getInfo() { * {@inheritdoc} */ protected function setUp() { - $this->configFactory = $this->getConfigFactoryStub(array('system.theme' => array(), 'system.theme.disabled' => array())); + $this->configFactory = $this->getConfigFactoryStub(array( + 'core.extension' => array( + 'module' => array(), + 'theme' => array(), + 'disabled' => array( + 'theme' => array(), + ), + ), + )); $this->moduleHandler = $this->getMock('Drupal\Core\Extension\ModuleHandlerInterface'); $this->cacheBackend = $this->getMock('Drupal\Core\Cache\CacheBackendInterface'); $this->infoParser = $this->getMock('Drupal\Core\Extension\InfoParserInterface'); @@ -128,21 +136,21 @@ public function testThemeEnableWithTooLongName() { public function testEnableSingleTheme() { $theme_list = array('theme_test'); - $this->configFactory->get('system.theme') + $this->configFactory->get('core.extension') ->expects($this->once()) ->method('set') - ->with('enabled.theme_test', 0) + ->with('theme.theme_test', 0) ->will($this->returnSelf()); - $this->configFactory->get('system.theme') + $this->configFactory->get('core.extension') ->expects($this->once()) ->method('save'); - $this->configFactory->get('system.theme.disabled') + $this->configFactory->get('core.extension') ->expects($this->once()) ->method('clear') - ->with('theme_test') + ->with('disabled.theme.theme_test') ->will($this->returnSelf()); - $this->configFactory->get('system.theme.disabled') + $this->configFactory->get('core.extension') ->expects($this->once()) ->method('save'); @@ -172,12 +180,12 @@ public function testEnableSingleTheme() { * @see \Drupal\Core\Extension\ThemeHandler::listInfo() */ public function testEnableAndListInfo() { - $this->configFactory->get('system.theme') + $this->configFactory->get('core.extension') ->expects($this->exactly(2)) ->method('set') ->will($this->returnSelf()); - $this->configFactory->get('system.theme.disabled') + $this->configFactory->get('core.extension') ->expects($this->exactly(2)) ->method('clear') ->will($this->returnSelf());