You are here

public function UpdateKernel::handle in Drupal 10

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

File

core/lib/Drupal/Core/Update/UpdateKernel.php, line 58

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::MAIN_REQUEST, $catch = TRUE) : Response {
  try {
    static::bootEnvironment();

    // First boot up basic things, like loading the include files.
    $this
      ->initializeSettings($request);
    ReverseProxyMiddleware::setSettingsOnRequest($request, Settings::getInstance());
    $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);
  }
}