Loading core/core.services.yml +2 −3 Original line number Diff line number Diff line Loading @@ -622,6 +622,8 @@ services: module_handler: class: Drupal\Core\Extension\ModuleHandler arguments: ['%app.root%', '%container.modules%', '@cache.bootstrap'] tags: - { name: needs_destruction } Drupal\Core\Extension\ModuleHandlerInterface: '@module_handler' module_installer: class: Drupal\Core\Extension\ModuleInstaller Loading Loading @@ -1393,9 +1395,6 @@ services: autowire: true redirect_leading_slashes_subscriber: class: Drupal\Core\EventSubscriber\RedirectLeadingSlashesSubscriber request_close_subscriber: class: Drupal\Core\EventSubscriber\RequestCloseSubscriber arguments: ['@module_handler'] config_import_subscriber: class: Drupal\Core\EventSubscriber\ConfigImportSubscriber tags: Loading core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.phpdeleted 100644 → 0 +0 −57 Original line number Diff line number Diff line <?php namespace Drupal\Core\EventSubscriber; use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\TerminateEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Subscriber for all responses. */ class RequestCloseSubscriber implements EventSubscriberInterface { /** * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; /** * Constructs a new RequestCloseSubscriber instance. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ public function __construct(ModuleHandlerInterface $module_handler) { $this->moduleHandler = $module_handler; } /** * Performs end of request tasks. * * @todo The body of this function has just been copied almost verbatim from * drupal_page_footer(). There's probably a lot in here that needs to get * removed/changed. Also, if possible, do more light-weight shutdowns on * AJAX requests. * * @param \Symfony\Component\HttpKernel\Event\TerminateEvent $event * The Event to process. */ public function onTerminate(TerminateEvent $event) { $this->moduleHandler->writeCache(); } /** * Registers the methods in this class that should be listeners. * * @return array * An array of event listener definitions. */ public static function getSubscribedEvents(): array { $events[KernelEvents::TERMINATE][] = ['onTerminate', 100]; return $events; } } core/lib/Drupal/Core/Extension/ModuleHandler.php +9 −1 Original line number Diff line number Diff line Loading @@ -5,12 +5,13 @@ use Drupal\Component\Graph\Graph; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; use Drupal\Core\Extension\Exception\UnknownExtensionException; /** * Class that manages modules in a Drupal installation. */ class ModuleHandler implements ModuleHandlerInterface { class ModuleHandler implements ModuleHandlerInterface, DestructableInterface { /** * List of loaded files. Loading Loading @@ -331,6 +332,13 @@ public function writeCache() { } } /** * {@inheritdoc} */ public function destruct() { $this->writeCache(); } /** * {@inheritdoc} */ Loading Loading
core/core.services.yml +2 −3 Original line number Diff line number Diff line Loading @@ -622,6 +622,8 @@ services: module_handler: class: Drupal\Core\Extension\ModuleHandler arguments: ['%app.root%', '%container.modules%', '@cache.bootstrap'] tags: - { name: needs_destruction } Drupal\Core\Extension\ModuleHandlerInterface: '@module_handler' module_installer: class: Drupal\Core\Extension\ModuleInstaller Loading Loading @@ -1393,9 +1395,6 @@ services: autowire: true redirect_leading_slashes_subscriber: class: Drupal\Core\EventSubscriber\RedirectLeadingSlashesSubscriber request_close_subscriber: class: Drupal\Core\EventSubscriber\RequestCloseSubscriber arguments: ['@module_handler'] config_import_subscriber: class: Drupal\Core\EventSubscriber\ConfigImportSubscriber tags: Loading
core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.phpdeleted 100644 → 0 +0 −57 Original line number Diff line number Diff line <?php namespace Drupal\Core\EventSubscriber; use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\TerminateEvent; use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Subscriber for all responses. */ class RequestCloseSubscriber implements EventSubscriberInterface { /** * @var \Drupal\Core\Extension\ModuleHandlerInterface */ protected $moduleHandler; /** * Constructs a new RequestCloseSubscriber instance. * * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler * The module handler. */ public function __construct(ModuleHandlerInterface $module_handler) { $this->moduleHandler = $module_handler; } /** * Performs end of request tasks. * * @todo The body of this function has just been copied almost verbatim from * drupal_page_footer(). There's probably a lot in here that needs to get * removed/changed. Also, if possible, do more light-weight shutdowns on * AJAX requests. * * @param \Symfony\Component\HttpKernel\Event\TerminateEvent $event * The Event to process. */ public function onTerminate(TerminateEvent $event) { $this->moduleHandler->writeCache(); } /** * Registers the methods in this class that should be listeners. * * @return array * An array of event listener definitions. */ public static function getSubscribedEvents(): array { $events[KernelEvents::TERMINATE][] = ['onTerminate', 100]; return $events; } }
core/lib/Drupal/Core/Extension/ModuleHandler.php +9 −1 Original line number Diff line number Diff line Loading @@ -5,12 +5,13 @@ use Drupal\Component\Graph\Graph; use Drupal\Component\Utility\NestedArray; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\DestructableInterface; use Drupal\Core\Extension\Exception\UnknownExtensionException; /** * Class that manages modules in a Drupal installation. */ class ModuleHandler implements ModuleHandlerInterface { class ModuleHandler implements ModuleHandlerInterface, DestructableInterface { /** * List of loaded files. Loading Loading @@ -331,6 +332,13 @@ public function writeCache() { } } /** * {@inheritdoc} */ public function destruct() { $this->writeCache(); } /** * {@inheritdoc} */ Loading