You are here

public function UpdateKernel::handle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Update/UpdateKernel.php \Drupal\Core\Update\UpdateKernel::handle()

Handles a Request to convert it to a Response.

When $catch is true, the implementation must catch all exceptions and do its best to convert them to a Response instance.

Parameters

Request $request A Request instance:

int $type The type of the request: (one of HttpKernelInterface::MASTER_REQUEST or HttpKernelInterface::SUB_REQUEST)

bool $catch Whether to catch exceptions or not:

Return value

Response A Response instance

Throws

\Exception When an Exception occurs during processing

Overrides DrupalKernel::handle

File

core/lib/Drupal/Core/Update/UpdateKernel.php, line 61
Contains \Drupal\Core\Update\UpdateKernel.

Class

UpdateKernel
Defines a kernel which is used primarily to run the update of Drupal.

Namespace

Drupal\Core\Update

Code

public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = TRUE) {
  try {
    static::bootEnvironment();

    // First boot up basic things, like loading the include files.
    $this
      ->initializeSettings($request);
    $this
      ->boot();
    $container = $this
      ->getContainer();

    /** @var \Symfony\Component\HttpFoundation\RequestStack $request_stack */
    $request_stack = $container
      ->get('request_stack');
    $request_stack
      ->push($request);
    $this
      ->preHandle($request);

    // Handle the actual request. We need the session both for authentication
    // as well as the DB update, like
    // \Drupal\system\Controller\DbUpdateController::batchFinished.
    $this
      ->bootSession($request, $type);
    $result = $this
      ->handleRaw($request);
    $this
      ->shutdownSession($request);
    return $result;
  } catch (\Exception $e) {
    return $this
      ->handleException($e, $request, $type);
  }
}