protected DrupalKernel::initializeRequestGlobals(Request $request)
Bootstraps the legacy global request variables.
@todo D8: Eliminate this entirely in favor of Request object.
Parameters
\Symfony\Component\HttpFoundation\Request $request: The current request.
File
- core/lib/Drupal/Core/DrupalKernel.php, line 1047
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 28 29 30 31 | protected function initializeRequestGlobals(Request $request ) { global $base_url ; // Set and derived from $base_url by this function. global $base_path , $base_root ; global $base_secure_url , $base_insecure_url ; // Create base URL. $base_root = $request ->getSchemeAndHttpHost(); $base_url = $base_root ; // For a request URI of '/index.php/foo', $_SERVER['SCRIPT_NAME'] is // '/index.php', whereas $_SERVER['PHP_SELF'] is '/index.php/foo'. if ( $dir = rtrim(dirname( $request ->server->get( 'SCRIPT_NAME' )), '\/' )) { // Remove "core" directory if present, allowing install.php, // authorize.php, and others to auto-detect a base path. $core_position = strrpos ( $dir , '/core' ); if ( $core_position !== FALSE && strlen ( $dir ) - 5 == $core_position ) { $base_path = substr ( $dir , 0, $core_position ); } else { $base_path = $dir ; } $base_url .= $base_path ; $base_path .= '/' ; } else { $base_path = '/' ; } } |
Please login to continue.