function DrupalKernel::boot
Same name in other branches
- 8.9.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::boot()
- 10 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::boot()
- 11.x core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::boot()
Overrides DrupalKernelInterface::boot
3 calls to DrupalKernel::boot()
- DrupalKernel::handle in core/
lib/ Drupal/ Core/ DrupalKernel.php - TestRunnerKernel::boot in core/
lib/ Drupal/ Core/ Test/ TestRunnerKernel.php - Boots the current kernel.
- UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php
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 458
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
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'])) {
// @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();
// Add the APCu prefix to use to cache found/not-found classes.
if (Settings::get('class_loader_auto_detect', TRUE) && method_exists($this->classLoader, 'setApcuPrefix')) {
// Vary the APCu key by which modules are installed to allow
// class_exists() checks to determine functionality.
$id = 'class_loader:' . crc32(implode(':', array_keys($this->container
->getParameter('container.modules'))));
$prefix = Settings::getApcuPrefix($id, $this->root);
$this->classLoader
->setApcuPrefix($prefix);
}
// @todo clean-up for PHP 8.0+ https://www.drupal.org/node/3210486
if (PHP_VERSION_ID < 80000 && in_array('phar', stream_get_wrappers(), TRUE)) {
// Set up a stream wrapper to handle insecurities due to PHP's builtin
// phar stream wrapper. This is not registered as a regular stream wrapper
// to prevent \Drupal\Core\File\FileSystem::validScheme() treating "phar"
// as a valid scheme.
try {
$behavior = new PharStreamWrapperBehavior();
PharStreamWrapperManager::initialize($behavior->withAssertion(new PharExtensionInterceptor()));
} catch (\LogicException $e) {
// Continue if the PharStreamWrapperManager is already initialized. For
// example, this occurs during a module install.
// @see \Drupal\Core\Extension\ModuleInstaller::install()
}
stream_wrapper_unregister('phar');
stream_wrapper_register('phar', PharStreamWrapper::class);
}
$this->booted = TRUE;
return $this;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.