W3cubDocs

/Drupal 8

public function DrupalKernel::boot

public DrupalKernel::boot()

Boots the current kernel.

Return value

$this

Overrides DrupalKernelInterface::boot

File

core/lib/Drupal/Core/DrupalKernel.php, line 403

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('apcu_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();

  $this->booted = TRUE;

  return $this;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!DrupalKernel.php/function/DrupalKernel::boot/8.1.x