protected function DrupalKernel::initializeSettings in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/lib/Drupal/Core/DrupalKernel.php \Drupal\Core\DrupalKernel::initializeSettings()
Locate site path and initialize settings singleton.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
Throws
\Symfony\Component\HttpKernel\Exception\BadRequestHttpException In case the host name in the request is not trusted.
2 calls to DrupalKernel::initializeSettings()
- DrupalKernel::handle in core/
lib/ Drupal/ Core/ DrupalKernel.php - Handles a Request to convert it to a Response.
- UpdateKernel::handle in core/
lib/ Drupal/ Core/ Update/ UpdateKernel.php - Handles a Request to convert it to a Response.
File
- core/
lib/ Drupal/ Core/ DrupalKernel.php, line 956 - Contains \Drupal\Core\DrupalKernel.
Class
- DrupalKernel
- The DrupalKernel class is the core of Drupal itself.
Namespace
Drupal\CoreCode
protected function initializeSettings(Request $request) {
$site_path = static::findSitePath($request);
$this
->setSitePath($site_path);
$class_loader_class = get_class($this->classLoader);
Settings::initialize($this->root, $site_path, $this->classLoader);
// Initialize our list of trusted HTTP Host headers to protect against
// header attacks.
$host_patterns = Settings::get('trusted_host_patterns', array());
if (PHP_SAPI !== 'cli' && !empty($host_patterns)) {
if (static::setupTrustedHosts($request, $host_patterns) === FALSE) {
throw new BadRequestHttpException('The provided host name is not valid for this server.');
}
}
// If the class loader is still the same, possibly upgrade to the APC class
// loader.
if ($class_loader_class == get_class($this->classLoader) && Settings::get('class_loader_auto_detect', TRUE) && function_exists('apc_fetch')) {
$prefix = Settings::getApcuPrefix('class_loader', $this->root);
$apc_loader = new \Symfony\Component\ClassLoader\ApcClassLoader($prefix, $this->classLoader);
$this->classLoader
->unregister();
$apc_loader
->register();
$this->classLoader = $apc_loader;
}
}