protected DrupalKernel::initializeSettings(Request $request)
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.
File
- core/lib/Drupal/Core/DrupalKernel.php, line 1011
 
Class
- DrupalKernel
 - The DrupalKernel class is the core of Drupal itself.
 
Namespace
Drupal\Core
Code
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('apcu_fetch')) {
    $prefix = Settings::getApcuPrefix('class_loader', $this->root);
    $apc_loader = new ApcClassLoader($prefix, $this->classLoader);
    $this->classLoader->unregister();
    $apc_loader->register();
    $this->classLoader = $apc_loader;
  }
}
Please login to continue.