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
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 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.