Commit 4cc0db2d authored by webchick's avatar webchick

Issue #1540136 by Rob Loach, Pete B: Simplify index.php by moving DRUPAL_ROOT to bootstrap.inc.

parent 1f87ed1d
......@@ -23,11 +23,6 @@
// Change the directory to the Drupal root.
chdir('..');
/**
* Defines the root directory of the Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
/**
* Global flag to identify update.php and authorize.php runs.
*
......@@ -63,11 +58,11 @@ function authorize_access_allowed() {
// *** Real work of the script begins here. ***
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/core/includes/common.inc';
require_once DRUPAL_ROOT . '/core/includes/file.inc';
require_once DRUPAL_ROOT . '/core/includes/module.inc';
require_once DRUPAL_ROOT . '/core/includes/ajax.inc';
require_once __DIR__ . '/includes/bootstrap.inc';
require_once __DIR__ . '/includes/common.inc';
require_once __DIR__ . '/includes/file.inc';
require_once __DIR__ . '/includes/module.inc';
require_once __DIR__ . '/includes/ajax.inc';
// We prepare only a minimal bootstrap. This includes the database and
// variables, however, so we have access to the class autoloader.
......
......@@ -326,6 +326,13 @@
*/
const CONFIG_STAGING_DIRECTORY = 'staging';
/**
* Defines the root directory of the Drupal installation.
*
* This strips two levels of directories off the current directory.
*/
define('DRUPAL_ROOT', dirname(dirname(__DIR__)));
/**
* Starts the timer with the specified name.
*
......
......@@ -257,7 +257,7 @@ function install_begin_request(&$install_state) {
}
// Allow command line scripts to override server variables used by Drupal.
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once __DIR__ . '/bootstrap.inc';
if (!$install_state['interactive']) {
drupal_override_server_variables($install_state['server']);
......
......@@ -8,11 +8,6 @@
// Change the directory to the Drupal root.
chdir('..');
/**
* Defines the root directory of the Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
/**
* Global flag to indicate the site is in installation mode.
*
......@@ -32,5 +27,5 @@
}
// Start the installer.
require_once DRUPAL_ROOT . '/core/includes/install.core.inc';
require_once __DIR__ . '/includes/install.core.inc';
install_drupal();
......@@ -8,12 +8,8 @@
// Change the directory to the Drupal root.
chdir('../../..');
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
// Load the Drupal bootstrap.
include_once dirname(dirname(__DIR__)) . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES);
if (config('statistics.settings')->get('count_content_views')) {
......
......@@ -18,7 +18,5 @@
// Change current directory to the Drupal root.
chdir('../../../..');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once dirname(dirname(dirname(__DIR__))) . '/includes/bootstrap.inc';
drupal_handle_request(TRUE);
......@@ -17,7 +17,5 @@
// Change current directory to the Drupal root.
chdir('../../../..');
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once dirname(dirname(dirname(__DIR__))) . '/includes/bootstrap.inc';
drupal_handle_request(TRUE);
......@@ -79,9 +79,9 @@
}
chdir('..');
define('DRUPAL_ROOT', getcwd());
include_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
$core = dirname(__DIR__);
include_once $core . '/includes/password.inc';
include_once $core . '/includes/bootstrap.inc';
$password_hasher = drupal_container()->get('password');
......
......@@ -311,8 +311,7 @@ function simpletest_script_init($server_software) {
}
chdir(realpath(__DIR__ . '/../..'));
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once dirname(__DIR__) . '/includes/bootstrap.inc';
}
/**
......
......@@ -21,11 +21,6 @@
// Change the directory to the Drupal root.
chdir('..');
/**
* Defines the root directory of the Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
// Exit early if an incompatible PHP version would cause fatal errors.
// The minimum version is specified explicitly, as DRUPAL_MINIMUM_PHP is not
// yet available. It is defined in bootstrap.inc, but it is not possible to
......@@ -404,12 +399,12 @@ function update_check_requirements($skip_warnings = FALSE) {
// We prepare a minimal bootstrap for the update requirements check to avoid
// reaching the PHP memory limit.
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once DRUPAL_ROOT . '/core/includes/update.inc';
require_once DRUPAL_ROOT . '/core/includes/common.inc';
require_once DRUPAL_ROOT . '/core/includes/file.inc';
require_once DRUPAL_ROOT . '/core/includes/unicode.inc';
require_once DRUPAL_ROOT . '/core/includes/schema.inc';
require_once __DIR__ . '/includes/bootstrap.inc';
require_once __DIR__ . '/includes/update.inc';
require_once __DIR__ . '/includes/common.inc';
require_once __DIR__ . '/includes/file.inc';
require_once __DIR__ . '/includes/unicode.inc';
require_once __DIR__ . '/includes/schema.inc';
update_prepare_d8_bootstrap();
// Determine if the current user has access to run update.php.
......
......@@ -8,10 +8,5 @@
* See COPYRIGHT.txt and LICENSE.txt files in the "core" directory.
*/
/**
* Root directory of Drupal installation.
*/
define('DRUPAL_ROOT', getcwd());
require_once DRUPAL_ROOT . '/core/includes/bootstrap.inc';
require_once __DIR__ . '/core/includes/bootstrap.inc';
drupal_handle_request();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment