diff --git a/core/includes/module.inc b/core/includes/module.inc index f65f0b8..79e382d 100644 --- a/core/includes/module.inc +++ b/core/includes/module.inc @@ -179,10 +179,12 @@ function drupal_required_modules() { function module_set_weight($module, $weight) { $extension_config = \Drupal::configFactory()->getEditable('core.extension'); if ($extension_config->get("module.$module") !== NULL) { + // Pre-cast the $weight to an integer so that we can save this without using + // schema. This is a performance improvement for module installation. $extension_config - ->set("module.$module", $weight) + ->set("module.$module", (int) $weight) ->set('module', module_config_sort($extension_config->get('module'))) - ->save(); + ->save(TRUE); // Prepare the new module list, sorted by weight, including filenames. // @see \Drupal\Core\Extension\ModuleHandler::install() diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 156a16c..8e5e0c3 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -155,10 +155,12 @@ public function install(array $module_list, $enable_dependencies = TRUE) { // exceptions if the configuration is not valid. $config_installer->checkConfigurationToInstall('module', $module); + // Save this data without checking schema. This is a performance + // improvement for module installation. $extension_config ->set("module.$module", 0) ->set('module', module_config_sort($extension_config->get('module'))) - ->save(); + ->save(TRUE); // Prepare the new module list, sorted by weight, including filenames. // This list is used for both the ModuleHandler and DrupalKernel. It @@ -382,8 +384,9 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { // Remove the schema. drupal_uninstall_schema($module); - // Remove the module's entry from the config. - \Drupal::configFactory()->getEditable('core.extension')->clear("module.$module")->save(); + // Remove the module's entry from the config. Don't check schema when + // uninstalling a module since we are only clearing a key. + \Drupal::configFactory()->getEditable('core.extension')->clear("module.$module")->save(TRUE); // 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 57a317e..9d790ae 100644 --- a/core/lib/Drupal/Core/Extension/ThemeHandler.php +++ b/core/lib/Drupal/Core/Extension/ThemeHandler.php @@ -260,10 +260,11 @@ public function install(array $theme_list, $install_dependencies = TRUE) { // configuration then stop installing. $this->configInstaller->checkConfigurationToInstall('theme', $key); - // The value is not used; the weight is ignored for themes currently. + // The value is not used; the weight is ignored for themes currently. Do + // not check schema when saving the configuration. $extension_config ->set("theme.$key", 0) - ->save(); + ->save(TRUE); // Add the theme to the current list. // @todo Remove all code that relies on $status property. @@ -358,7 +359,9 @@ public function uninstall(array $theme_list) { $this->configManager->uninstall('theme', $key); } - $extension_config->save(); + // Don't check schema when uninstalling a theme since we are only clearing + // keys. + $extension_config->save(TRUE); $this->state->set('system.theme.data', $current_theme_data); $this->resetSystem();