Mercurial > hg > isophonics-drupal-site
view core/lib/Drupal/Core/EventSubscriber/RequestCloseSubscriber.php @ 13:5fb285c0d0e3
Update Drupal core to 8.4.7 via Composer. Security update; I *think* we've
been lucky to get away with this so far, as we don't support self-registration
which seems to be used by the so-called "drupalgeddon 2" attack that 8.4.5
was vulnerable to.
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:33:26 +0100 |
parents | 4c8ae668cc8c |
children |
line wrap: on
line source
<?php namespace Drupal\Core\EventSubscriber; use Drupal\Core\Extension\ModuleHandlerInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\PostResponseEvent; 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\PostResponseEvent $event * The Event to process. */ public function onTerminate(PostResponseEvent $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() { $events[KernelEvents::TERMINATE][] = ['onTerminate', 100]; return $events; } }