diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 2d4d803..f5e3c2d 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -294,13 +294,12 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { // configured as enabled. Custom or overridden module handlers might contain // the module already, which means that it might be loaded, but not // necessarily installed. - $schema_store = \Drupal::keyValue('system.schema'); - $entity_manager = \Drupal::entityManager(); foreach ($module_list as $module) { // Clean up all entity bundles (including fields) of every entity type // provided by the module that is being uninstalled. // @todo Clean this up in https://www.drupal.org/node/2350111. + $entity_manager = \Drupal::entityManager(); foreach ($entity_manager->getDefinitions() as $entity_type_id => $entity_type) { if ($entity_type->getProvider() == $module) { foreach (array_keys($entity_manager->getBundleInfo($entity_type_id)) as $bundle) { @@ -333,6 +332,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { drupal_uninstall_schema($module); // Remove the module's entry from the config. + $extension_config = \Drupal::config('core.extension'); $extension_config->clear("module.$module")->save(); // Update the module handler to remove the module. @@ -368,6 +368,7 @@ public function uninstall(array $module_list, $uninstall_dependents = TRUE) { \Drupal::logger('system')->info('%module module uninstalled.', array('%module' => $module)); + $schema_store = \Drupal::keyValue('system.schema'); $schema_store->delete($module); } drupal_get_installed_schema_version(NULL, TRUE); @@ -432,7 +433,7 @@ protected function updateKernel($module_filenames) { // After rebuilding the container we need to update the injected // dependencies. $container = $this->kernel->getContainer(); - $this->cacheBackend = $container->get('cache.bootstrap'); + $this->moduleHandler = $container->get('module_handler'); } }