You are here

public function DrupalKernel::boot in Zircon Profile 8

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

Boots the current kernel.

Return value

$this

Overrides DrupalKernelInterface::boot

4 calls to DrupalKernel::boot()
DrupalKernel::handle in core/lib/Drupal/Core/DrupalKernel.php
Handles a Request to convert it to a Response.
DrupalKernel::prepareLegacyRequest in core/lib/Drupal/Core/DrupalKernel.php
Prepare the kernel for handling a request without handling the request.
TestRunnerKernel::boot in core/lib/Drupal/Core/Test/TestRunnerKernel.php
Boots the current kernel.
UpdateKernel::handle in core/lib/Drupal/Core/Update/UpdateKernel.php
Handles a Request to convert it to a Response.
1 method overrides DrupalKernel::boot()
TestRunnerKernel::boot in core/lib/Drupal/Core/Test/TestRunnerKernel.php
Boots the current kernel.

File

core/lib/Drupal/Core/DrupalKernel.php, line 407
Contains \Drupal\Core\DrupalKernel.

Class

DrupalKernel
The DrupalKernel class is the core of Drupal itself.

Namespace

Drupal\Core

Code

public function boot() {
  if ($this->booted) {
    return $this;
  }

  // Ensure that findSitePath is set.
  if (!$this->sitePath) {
    throw new \Exception('Kernel does not have site path set before calling boot()');
  }

  // Initialize the FileCacheFactory component. We have to do it here instead
  // of in \Drupal\Component\FileCache\FileCacheFactory because we can not use
  // the Settings object in a component.
  $configuration = Settings::get('file_cache');

  // Provide a default configuration, if not set.
  if (!isset($configuration['default'])) {
    $configuration['default'] = [
      'class' => '\\Drupal\\Component\\FileCache\\FileCache',
      'cache_backend_class' => NULL,
      'cache_backend_configuration' => [],
    ];

    // @todo Use extension_loaded('apcu') for non-testbot
    //  https://www.drupal.org/node/2447753.
    if (function_exists('apc_fetch')) {
      $configuration['default']['cache_backend_class'] = '\\Drupal\\Component\\FileCache\\ApcuFileCacheBackend';
    }
  }
  FileCacheFactory::setConfiguration($configuration);
  FileCacheFactory::setPrefix(Settings::getApcuPrefix('file_cache', $this->root));
  $this->bootstrapContainer = new $this->bootstrapContainerClass(Settings::get('bootstrap_container_definition', $this->defaultBootstrapContainerDefinition));

  // Initialize the container.
  $this
    ->initializeContainer();

  // Ensure mt_rand() is reseeded to prevent random values from one page load
  // being exploited to predict random values in subsequent page loads.
  $seed = unpack("L", Crypt::randomBytes(4));
  mt_srand($seed[1]);
  $this->booted = TRUE;
  return $this;
}