Example #1
0
 /**
  * {@inheritdoc}
  */
 public function terminate()
 {
     parent::terminate();
     if ($this->kernel) {
         $response = Response::create('');
         $this->kernel->terminate($this->request, $response);
     }
 }
 /**
  * Triggers kernel.response and sends a form response.
  *
  * @param \Symfony\Component\HttpFoundation\Response $response
  *   A response object.
  */
 protected function sendResponse(Response $response)
 {
     $request = $this->requestStack->getCurrentRequest();
     $event = new FilterResponseEvent($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response);
     $this->eventDispatcher->dispatch(KernelEvents::RESPONSE, $event);
     // Prepare and send the response.
     $event->getResponse()->prepare($request)->send();
     $this->kernel->terminate($request, $response);
 }
Example #3
0
 /**
  * Updates the kernel module list.
  *
  * @param string $module_filenames
  *   The list of installed modules.
  */
 protected function updateKernel($module_filenames)
 {
     // This reboots the kernel to register the module's bundle and its services
     // in the service container. The $module_filenames argument is taken over as
     // %container.modules% parameter, which is passed to a fresh ModuleHandler
     // instance upon first retrieval.
     $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');
 }
Example #4
0
 /**
  * Gets the root path under which projects are installed or updated.
  *
  * The Update Manager will ensure that project files can only be copied to
  * specific subdirectories of this root path.
  *
  * @return string
  */
 public function get()
 {
     // Normally the Update Manager's root path is the same as the app root (the
     // directory in which the Drupal site is installed).
     $root_path = $this->drupalKernel->getAppRoot();
     // When running in a test site, change the root path to be the testing site
     // directory. This ensures that it will always be writable by the webserver
     // (thereby allowing the actual extraction and installation of projects by
     // the Update Manager to be tested) and also ensures that new project files
     // added there won't be visible to the parent site and will be properly
     // cleaned up once the test finishes running. This is done here (rather
     // than having the tests enable a module which overrides the update root
     // factory service) to ensure that the parent site is automatically kept
     // clean without relying on test authors to take any explicit steps. See
     // also \Drupal\update\Tests\UpdateTestBase::setUp().
     if (DRUPAL_TEST_IN_CHILD_SITE) {
         $kernel = $this->drupalKernel;
         $request = $this->requestStack->getCurrentRequest();
         $root_path .= '/' . $kernel::findSitePath($request);
     }
     return $root_path;
 }
Example #5
0
 /**
  * Gets the site path.
  *
  * @return string
  *   The site path.
  */
 public function get()
 {
     return $this->drupalKernel->getSitePath();
 }
Example #6
0
 /**
  * {@inheritdoc}
  */
 public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE)
 {
     $this->drupalKernel->preHandle($request);
     return $this->httpKernel->handle($request, $type, $catch);
 }
Example #7
0
 /**
  * Gets the app root.
  *
  * @return string
  */
 public function get()
 {
     return $this->drupalKernel->getAppRoot();
 }
 /**
  * Invalidates the container when the definition settings are updated.
  *
  * @param \Drupal\Core\Config\ConfigCrudEvent $event
  *   The configuration event.
  */
 public function onConfigSave(ConfigCrudEvent $event)
 {
     if ($event->getConfig()->getName() === 'libraries.settings' && $event->isChanged('definition')) {
         $this->kernel->invalidateContainer();
     }
 }