summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathaniel Catchpole2015-10-05 10:45:34 (GMT)
committerNathaniel Catchpole2015-10-05 10:45:34 (GMT)
commitc2af04eb7c748af65d893575c3bf7f9a08f3c4b8 (patch)
tree8d1f197059f2cf9330134948eafc40859272c551
parent85fa64de8d0a7af20a3ed4da8f32908c9c367eb5 (diff)
Issue #2528988 by znerol: Remove the option to specify a base_url from within settings.php
-rw-r--r--core/lib/Drupal/Core/DrupalKernel.php51
-rw-r--r--core/lib/Drupal/Core/Site/Settings.php2
-rw-r--r--sites/default/default.settings.php22
3 files changed, 19 insertions, 56 deletions
diff --git a/core/lib/Drupal/Core/DrupalKernel.php b/core/lib/Drupal/Core/DrupalKernel.php
index 2ddc3ee..16b3bac 100644
--- a/core/lib/Drupal/Core/DrupalKernel.php
+++ b/core/lib/Drupal/Core/DrupalKernel.php
@@ -992,47 +992,32 @@ class DrupalKernel implements DrupalKernelInterface, TerminableInterface {
* @todo D8: Eliminate this entirely in favor of Request object.
*/
protected function initializeRequestGlobals(Request $request) {
- // Provided by settings.php.
global $base_url;
// Set and derived from $base_url by this function.
global $base_path, $base_root;
global $base_secure_url, $base_insecure_url;
- // @todo Refactor with the Symfony Request object.
- if (isset($base_url)) {
- // Parse fixed base URL from settings.php.
- $parts = parse_url($base_url);
- if (!isset($parts['path'])) {
- $parts['path'] = '';
- }
- $base_path = $parts['path'] . '/';
- // Build $base_root (everything until first slash after "scheme://").
- $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
- }
- else {
- // 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 .= '/';
+ // 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 = '/';
+ $base_path = $dir;
}
+ $base_url .= $base_path;
+ $base_path .= '/';
+ }
+ else {
+ $base_path = '/';
}
$base_secure_url = str_replace('http://', 'https://', $base_url);
$base_insecure_url = str_replace('https://', 'http://', $base_url);
diff --git a/core/lib/Drupal/Core/Site/Settings.php b/core/lib/Drupal/Core/Site/Settings.php
index 3b37063..ee786db 100644
--- a/core/lib/Drupal/Core/Site/Settings.php
+++ b/core/lib/Drupal/Core/Site/Settings.php
@@ -112,7 +112,7 @@ final class Settings {
*/
public static function initialize($app_root, $site_path, &$class_loader) {
// Export these settings.php variables to the global namespace.
- global $base_url, $config_directories, $config;
+ global $config_directories, $config;
$settings = array();
$config = array();
$databases = array();
diff --git a/sites/default/default.settings.php b/sites/default/default.settings.php
index 1ea5d72..7d3a3ae 100644
--- a/sites/default/default.settings.php
+++ b/sites/default/default.settings.php
@@ -528,28 +528,6 @@ if ($settings['hash_salt']) {
# $settings['maintenance_theme'] = 'bartik';
/**
- * Base URL (optional).
- *
- * If Drupal is generating incorrect URLs on your site, which could
- * be in HTML headers (links to CSS and JS files) or visible links on pages
- * (such as in menus), uncomment the Base URL statement below (remove the
- * leading hash sign) and fill in the absolute URL to your Drupal installation.
- *
- * You might also want to force users to use a given domain.
- * See the .htaccess file for more information.
- *
- * Examples:
- * $base_url = 'http://www.example.com';
- * $base_url = 'http://www.example.com:8888';
- * $base_url = 'http://www.example.com/drupal';
- * $base_url = 'https://www.example.com:8888/drupal';
- *
- * It is not allowed to have a trailing slash; Drupal will add it
- * for you.
- */
-# $base_url = 'http://www.example.com'; // NO trailing slash!
-
-/**
* PHP settings:
*
* To see what PHP settings are possible, including whether they can be set at