X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fcore%2Flib%2FDrupal%2FCore%2FExtension%2FModuleInstaller.php;h=65466a2d657542847a5f8429c5138631ee59bd6b;hp=5e9a4933bef11b5346afd32025c71539c8be26ce;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hpb=74df008bdbb3a11eeea356744f39b802369bda3c diff --git a/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 5e9a4933b..65466a2d6 100644 --- a/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -14,6 +14,11 @@ use Drupal\Core\Serialization\Yaml; * * It registers the module in config, installs its own configuration, * installs the schema, updates the Drupal kernel and more. + * + * We don't inject dependencies yet, as we would need to reload them after + * each installation or uninstallation of a module. + * https://www.drupal.org/project/drupal/issues/2350111 for example tries to + * solve this dilemma. */ class ModuleInstaller implements ModuleInstallerInterface { @@ -170,7 +175,7 @@ class ModuleInstaller implements ModuleInstallerInterface { $module_filenames[$name] = $current_module_filenames[$name]; } else { - $module_path = drupal_get_path('module', $name); + $module_path = \Drupal::service('extension.list.module')->getPath($name); $pathname = "$module_path/$name.info.yml"; $filename = file_exists($module_path . "/$name.module") ? "$name.module" : NULL; $module_filenames[$name] = new Extension($this->root, 'module', $pathname, $filename); @@ -186,10 +191,10 @@ class ModuleInstaller implements ModuleInstallerInterface { $this->moduleHandler->load($module); module_load_install($module); - // Clear the static cache of system_rebuild_module_data() to pick up the - // new module, since it merges the installation status of modules into - // its statically cached list. - drupal_static_reset('system_rebuild_module_data'); + // Clear the static cache of the "extension.list.module" service to pick + // up the new module, since it merges the installation status of modules + // into its statically cached list. + \Drupal::service('extension.list.module')->reset(); // Update the kernel to include it. $this->updateKernel($module_filenames); @@ -345,7 +350,6 @@ class ModuleInstaller implements ModuleInstallerInterface { if ($uninstall_dependents) { // Add dependent modules to the list. The new modules will be processed as // the foreach loop continues. - $profile = drupal_get_profile(); foreach ($module_list as $module => $value) { foreach (array_keys($module_data[$module]->required_by) as $dependent) { if (!isset($module_data[$dependent])) { @@ -354,7 +358,7 @@ class ModuleInstaller implements ModuleInstallerInterface { } // Skip already uninstalled modules. - if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent]) && $dependent != $profile) { + if (isset($installed_modules[$dependent]) && !isset($module_list[$dependent])) { $module_list[$dependent] = $dependent; } } @@ -447,10 +451,10 @@ class ModuleInstaller implements ModuleInstallerInterface { // Remove any potential cache bins provided by the module. $this->removeCacheBins($module); - // Clear the static cache of system_rebuild_module_data() to pick up the - // new module, since it merges the installation status of modules into - // its statically cached list. - drupal_static_reset('system_rebuild_module_data'); + // Clear the static cache of the "extension.list.module" service to pick + // up the new module, since it merges the installation status of modules + // into its statically cached list. + \Drupal::service('extension.list.module')->reset(); // Clear plugin manager caches. \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();