diff --git a/core/authorize.php b/core/authorize.php index ecb7e22..fd9e2f4 100644 --- a/core/authorize.php +++ b/core/authorize.php @@ -69,15 +69,9 @@ function authorize_access_allowed() { 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. -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); - -$request = Request::createFromGlobals(); -\Drupal::getContainer()->set('request', $request); - -// This must go after drupal_bootstrap(), which unsets globals! -global $conf; +// Prepare a minimal bootstrap. +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); +$request = \Drupal::request(); // We have to enable the user and system modules, even to check access and // display errors via the maintenance theme. diff --git a/core/includes/bootstrap.inc b/core/includes/bootstrap.inc index 1568f45..7f6e959 100644 --- a/core/includes/bootstrap.inc +++ b/core/includes/bootstrap.inc @@ -138,19 +138,14 @@ const DRUPAL_BOOTSTRAP_PAGE_CACHE = 2; /** - * Fourth bootstrap phase: initialize the variable system. + * Fourth bootstrap phase: load code for subsystems and modules. */ -const DRUPAL_BOOTSTRAP_VARIABLES = 3; - -/** - * Fifth bootstrap phase: load code for subsystems and modules. - */ -const DRUPAL_BOOTSTRAP_CODE = 4; +const DRUPAL_BOOTSTRAP_CODE = 3; /** * Final bootstrap phase: initialize language, path, theme, and modules. */ -const DRUPAL_BOOTSTRAP_FULL = 5; +const DRUPAL_BOOTSTRAP_FULL = 4; /** * Role ID for anonymous users; should match what's in the "role" table. @@ -876,6 +871,11 @@ function variable_initialize($conf = array()) { function variable_get($name, $default = NULL) { global $conf; + // @todo D8: Temporary hack until full removal. + if (!isset($conf)) { + $conf = variable_initialize(isset($conf) ? $conf : array()); + } + return isset($conf[$name]) ? $conf[$name] : $default; } @@ -1743,7 +1743,6 @@ function drupal_anonymous_user() { * - DRUPAL_BOOTSTRAP_CONFIGURATION: Initializes configuration. * - DRUPAL_BOOTSTRAP_KERNEL: Initalizes a kernel. * - DRUPAL_BOOTSTRAP_PAGE_CACHE: Tries to serve a cached page. - * - DRUPAL_BOOTSTRAP_VARIABLES: Initializes the variable system. * - DRUPAL_BOOTSTRAP_CODE: Loads code for subsystems and modules. * - DRUPAL_BOOTSTRAP_FULL: Fully loads Drupal. Validates and fixes input * data. @@ -1760,7 +1759,6 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { DRUPAL_BOOTSTRAP_CONFIGURATION, DRUPAL_BOOTSTRAP_KERNEL, DRUPAL_BOOTSTRAP_PAGE_CACHE, - DRUPAL_BOOTSTRAP_VARIABLES, DRUPAL_BOOTSTRAP_CODE, DRUPAL_BOOTSTRAP_FULL, ); @@ -1802,10 +1800,6 @@ function drupal_bootstrap($phase = NULL, $new_phase = TRUE) { _drupal_bootstrap_page_cache(); break; - case DRUPAL_BOOTSTRAP_VARIABLES: - _drupal_bootstrap_variables(); - break; - case DRUPAL_BOOTSTRAP_CODE: require_once __DIR__ . '/common.inc'; _drupal_bootstrap_code(); @@ -2010,7 +2004,6 @@ function _drupal_bootstrap_page_cache() { $cache_enabled = TRUE; } else { - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); $config = \Drupal::config('system.performance'); $cache_enabled = $config->get('cache.page.use_internal'); } @@ -2079,16 +2072,6 @@ function _drupal_initialize_db_test_prefix() { } /** - * Loads system variables and all enabled bootstrap modules. - */ -function _drupal_bootstrap_variables() { - global $conf; - - // Load variables from the database, but do not overwrite variables set in settings.php. - $conf = variable_initialize(isset($conf) ? $conf : array()); -} - -/** * Returns the current bootstrap phase for this Drupal process. * * The current phase is the one most recently completed by drupal_bootstrap(). diff --git a/core/includes/language.inc b/core/includes/language.inc index 618e3a7..60c6490 100644 --- a/core/includes/language.inc +++ b/core/includes/language.inc @@ -476,7 +476,6 @@ function language_negotiation_method_invoke($method_id, $method = NULL, $request $cache_enabled = TRUE; } else { - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES, FALSE); $config = \Drupal::config('system.performance'); $cache_enabled = $config->get('cache.page.use_internal'); } diff --git a/core/includes/update.inc b/core/includes/update.inc index b17624f..fd84c20 100644 --- a/core/includes/update.inc +++ b/core/includes/update.inc @@ -119,6 +119,8 @@ function update_prepare_d8_bootstrap() { // Do not attempt to dump and write it. $kernel = new DrupalKernel('update', drupal_classloader(), FALSE); $kernel->boot(); + $request = Request::createFromGlobals(); + \Drupal::getContainer()->set('request', $request); // If any of the required settings needs to be written, then settings.php // needs to be writable. @@ -315,9 +317,8 @@ function update_prepare_d8_bootstrap() { update_add_cache_columns($table); } - // Bootstrap variables so we can update theme while preparing the update - // process. - drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); + // Bootstrap to cache system. + drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); // Update the 'language_default' system variable, if configured. // Required to run before drupal_install_config_directories(), since that @@ -458,6 +459,7 @@ function update_prepare_d8_bootstrap() { new Settings($settings); $kernel = new DrupalKernel('update', drupal_classloader(), FALSE); $kernel->boot(); + \Drupal::getContainer()->set('request', $request); // Clear the D7 caches, to ensure that for example the theme_registry does not // take part in the upgrade process. diff --git a/core/modules/statistics/statistics.php b/core/modules/statistics/statistics.php index ed132e8..59675f1 100644 --- a/core/modules/statistics/statistics.php +++ b/core/modules/statistics/statistics.php @@ -11,7 +11,7 @@ // Load the Drupal bootstrap. require_once dirname(dirname(__DIR__)) . '/vendor/autoload.php'; require_once dirname(dirname(__DIR__)) . '/includes/bootstrap.inc'; -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); if (\Drupal::config('statistics.settings')->get('count_content_views')) { $nid = filter_input(INPUT_POST, 'nid', FILTER_VALIDATE_INT); diff --git a/core/update.php b/core/update.php index 527a703..7097df2 100644 --- a/core/update.php +++ b/core/update.php @@ -347,11 +347,8 @@ function update_check_requirements($skip_warnings = FALSE) { update_prepare_d8_bootstrap(); // Determine if the current user has access to run update.php. -drupal_bootstrap(DRUPAL_BOOTSTRAP_VARIABLES); - -// A request object from the HTTPFoundation to tell us about the request. -$request = Request::createFromGlobals(); -\Drupal::getContainer()->set('request', $request); +drupal_bootstrap(DRUPAL_BOOTSTRAP_PAGE_CACHE); +$request = \Drupal::request(); require_once DRUPAL_ROOT . '/' . settings()->get('session_inc', 'core/includes/session.inc'); drupal_session_initialize();