diff --git a/core/core.services.yml b/core/core.services.yml index b965322..ba5e681 100644 --- a/core/core.services.yml +++ b/core/core.services.yml @@ -222,9 +222,9 @@ services: logger.channel.form: parent: logger.channel_base arguments: ['form'] - logger.channel.system: + logger.channel.modules: parent: logger.channel_base - arguments: ['system'] + arguments: ['modules'] logger.log_message_parser: class: Drupal\Core\Logger\LogMessageParser @@ -292,7 +292,7 @@ services: arguments: ['@app.root', '%container.modules%', '@cache.bootstrap'] module_installer: class: Drupal\Core\Extension\ModuleInstaller - arguments: ['@app.root', '@module_handler', '@kernel', '@config.factory', '@config.installer', '@plugin.cache_clearer', '@router.builder_indicator', '@entity.manager', '@stream_wrapper_manager', '@theme_handler', '@logger.channel.system', '@config.manager', '@keyvalue'] + arguments: ['@app.root', '@module_handler', '@kernel', '@config.factory', '@config.installer', '@plugin.cache_clearer', '@router.builder_indicator', '@entity.manager', '@stream_wrapper_manager', '@theme_handler', '@logger.channel.modules', '@config.manager', '@keyvalue'] tags: - { name: service_collector, tag: 'module_install.uninstall_validator', call: addUninstallValidator } arguments: ['@app.root', '@module_handler', '@kernel'] diff --git a/core/lib/Drupal/Core/DependencyInjection/DependencyReinjectionTrait.php b/core/lib/Drupal/Core/DependencyInjection/DependencyReinjectionTrait.php new file mode 100644 index 0000000..fcdf447 --- /dev/null +++ b/core/lib/Drupal/Core/DependencyInjection/DependencyReinjectionTrait.php @@ -0,0 +1,31 @@ + $value) { + if (is_object($value) && isset($value->_serviceId)) { + $this->$key = $container->get($value->_serviceId); + } + } + } + +} diff --git a/core/lib/Drupal/Core/Extension/ModuleInstaller.php b/core/lib/Drupal/Core/Extension/ModuleInstaller.php index 65fe910..0afccd8 100644 --- a/core/lib/Drupal/Core/Extension/ModuleInstaller.php +++ b/core/lib/Drupal/Core/Extension/ModuleInstaller.php @@ -13,6 +13,7 @@ use Drupal\Core\Config\ConfigFactoryInterface; use Drupal\Core\Config\ConfigInstallerInterface; use Drupal\Core\Config\ConfigManagerInterface; +use Drupal\Core\DependencyInjection\DependencyReinjectionTrait; use Drupal\Core\DrupalKernelInterface; use Drupal\Core\Entity\EntityManagerInterface; use Drupal\Core\KeyValueStore\KeyValueFactoryInterface; @@ -29,6 +30,8 @@ */ class ModuleInstaller implements ModuleInstallerInterface { + use DependencyReinjectionTrait; + /** * The module handler. * @@ -585,18 +588,7 @@ protected function updateKernel($module_filenames) { $this->kernel->updateModules($module_filenames, $module_filenames); // After rebuilding the container we need to update the injected // dependencies. - $container = $this->kernel->getContainer(); - $this->moduleHandler = $container->get('module_handler'); - $this->configFactory = $container->get('config.factory'); - $this->configInstaller = $container->get('config.installer'); - $this->pluginCacheClearer = $container->get('plugin.cache_clearer'); - $this->routeRebuildIndicator = $container->get('router.builder_indicator'); - $this->entityManager = $container->get('entity.manager'); - $this->streamWrapperManager = $container->get('stream_wrapper_manager'); - $this->themeHandler = $container->get('theme_handler'); - $this->logger = $container->get('logger.channel.system'); - $this->configManager = $container->get('config.manager'); - $this->keyValueFactory = $container->get('keyvalue'); + $this->updateDependencies($this->kernel->getContainer()); } /**