diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index c9308fb..d9d39c8 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -97,7 +97,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { } // Required for module installation checks. - include_once DRUPAL_ROOT . '/core/includes/install.inc'; + include_once $this->root . '/core/includes/install.inc'; /** @var \Drupal\Core\Config\ConfigInstaller $config_installer */ $config_installer = \Drupal::service('config.installer'); @@ -144,7 +144,7 @@ public function install(array $module_list, $enable_dependencies = TRUE) { $module_path = drupal_get_path('module', $name); $pathname = "$module_path/$name.info.yml"; $filename = file_exists($module_path . "/$name.module") ? "$name.module" : NULL; - $module_filenames[$name] = new Extension('module', $pathname, $filename); + $module_filenames[$name] = new Extension($this->root, 'module', $pathname, $filename); } } @@ -308,12 +308,13 @@ 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) { @@ -346,7 +347,6 @@ 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. @@ -382,7 +382,6 @@ 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);