Commit 4511dc22 authored by alexpott's avatar alexpott

Issue #2228921 by sun: Consolidate system.module + system.theme +...

Issue #2228921 by sun: Consolidate system.module + system.theme + system.theme.disabled into core.extension config.
parent b3df95c5
module: {}
theme:
stark: 0
disabled:
theme: {}
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'
......@@ -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;
......
......@@ -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.
......
......@@ -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');
}
/**
......
......@@ -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];
......
......@@ -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();
}
}
......
......@@ -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)) {
......
......@@ -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
......
......@@ -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));
......
......@@ -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'
);
}
}
......@@ -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();
......
......@@ -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
......
......@@ -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();
......
......@@ -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);
......
......@@ -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.');
......
......@@ -53,7 +53,7 @@ protected function delete($name) {
*/
protected function testlistAll() {
$expected_files = array(
'system.module',
'core.extension',
'system.performance',
);
......
......@@ -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')));
}
......
......@@ -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')));
......
......@@ -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.
......
......@@ -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'
......@@ -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);
}
/**
......
......@@ -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.');
}
......
......@@ -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]);
......
......@@ -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(
......
......@@ -94,7 +94,15 @@ public static function getInfo() {
* {@inheritdoc}
*/
protected function setUp