Commit 7670ea41 authored by catch's avatar catch

Issue #2347625 by alexpott, idebr: Remove drupal_bootstrap and drupal_get_bootstrap_phase

parent a305f770
......@@ -53,34 +53,6 @@
*/
const ERROR_REPORTING_DISPLAY_VERBOSE = 'verbose';
/**
* First bootstrap phase: initialize configuration.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
*/
const DRUPAL_BOOTSTRAP_CONFIGURATION = 0;
/**
* Second bootstrap phase, initialize a kernel.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
*/
const DRUPAL_BOOTSTRAP_KERNEL = 1;
/**
* Third bootstrap phase: load code for subsystems and modules.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
*/
const DRUPAL_BOOTSTRAP_CODE = 2;
/**
* Final bootstrap phase: initialize language, path, theme, and modules.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
*/
const DRUPAL_BOOTSTRAP_FULL = 3;
/**
* Role ID for anonymous users; should match what's in the "role" table.
*/
......@@ -683,59 +655,6 @@ function drupal_get_messages($type = NULL, $clear_queue = TRUE) {
return array();
}
/**
* Ensures Drupal is bootstrapped to the specified phase.
*
* In order to bootstrap Drupal from another PHP script, you can use this code:
* @code
* require_once '/path/to/drupal/core/vendor/autoload.php';
* require_once '/path/to/drupal/core/includes/bootstrap.inc';
* drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
* @endcode
*
* @param $phase
* A constant telling which phase to bootstrap to. Possible values:
* - DRUPAL_BOOTSTRAP_CONFIGURATION: Initializes configuration.
* - DRUPAL_BOOTSTRAP_KERNEL: Initializes a kernel.
*
* @return int
* The most recently completed phase.
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
* Interact directly with the kernel.
*/
function drupal_bootstrap($phase = NULL) {
// Temporary variables used for booting later legacy phases.
/** @var \Drupal\Core\DrupalKernel $kernel */
static $kernel;
static $boot_level = 0;
if (isset($phase)) {
$request = Request::createFromGlobals();
for ($current_phase = $boot_level; $current_phase <= $phase; $current_phase++) {
switch ($current_phase) {
case DRUPAL_BOOTSTRAP_CONFIGURATION:
$classloader = require __DIR__ . '/../vendor/autoload.php';
$kernel = DrupalKernel::createFromRequest($request, $classloader, 'prod');
break;
case DRUPAL_BOOTSTRAP_KERNEL:
$kernel->boot();
break;
case DRUPAL_BOOTSTRAP_CODE:
case DRUPAL_BOOTSTRAP_FULL:
$kernel->prepareLegacyRequest($request);
break;
}
}
$boot_level = $phase;
}
return \Drupal::hasContainer() ? DRUPAL_BOOTSTRAP_CODE : DRUPAL_BOOTSTRAP_CONFIGURATION;
}
/**
* Returns the time zone of the current user.
*/
......@@ -802,19 +721,6 @@ function _drupal_exception_handler($exception) {
}
}
/**
* Returns the current bootstrap phase for this Drupal process.
*
* The current phase is the one most recently completed by drupal_bootstrap().
*
* @see drupal_bootstrap()
*
* @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.
*/
function drupal_get_bootstrap_phase() {
return drupal_bootstrap();
}
/**
* Returns the test prefix if this is an internal request from SimpleTest.
*
......
......@@ -121,7 +121,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
// Initialize a maintenance theme if the bootstrap was not complete.
// Do it early because drupal_set_message() triggers a
// \Drupal\Core\Theme\ThemeManager::initTheme().
if ($fatal && drupal_get_bootstrap_phase() < DRUPAL_BOOTSTRAP_CODE) {
if ($fatal && \Drupal::hasService('theme.manager')) {
// The installer initializes a maintenance theme at the earliest possible
// point in time already. Do not unset that.
if (!$is_installer) {
......@@ -258,8 +258,8 @@ function _drupal_log_error($error, $fatal = FALSE) {
/**
* Returns the current error level.
*
* This function should only be used to get the current error level prior to
* DRUPAL_BOOTSTRAP_KERNEL or before Drupal is installed. In all other situations
* This function should only be used to get the current error level prior to the
* kernel being booted or before Drupal is installed. In all other situations
* the following code is preferred:
* @code
* \Drupal::config('system.logging')->get('error_level');
......
......@@ -1843,10 +1843,6 @@ function install_finished(&$install_state) {
* Performs batch installation of modules.
*/
function _install_module_batch($module, $module_name, &$context) {
// Install and enable the module right away, so that the module will be
// loaded by drupal_bootstrap in subsequent batch requests, and other
// modules possibly depending on it can safely perform their installation
// steps.
\Drupal::service('module_installer')->install(array($module), FALSE);
$context['results'][] = $module;
$context['message'] = t('Installed %module module.', array('%module' => $module_name));
......
......@@ -15,8 +15,6 @@
/**
* Rebuilds all caches even when Drupal itself does not work.
*
* Requires DRUPAL_BOOTSTRAP_CONFIGURATION.
*
* @param \Composer\Autoload\ClassLoader $classloader
* The classloader.
* @param \Symfony\Component\HttpFoundation\Request $request
......
......@@ -859,8 +859,8 @@ protected function setUp() {
file_put_contents($directory . '/services.yml', $yaml->dump($services));
}
// Since Drupal is bootstrapped already, install_begin_request() will not
// bootstrap into DRUPAL_BOOTSTRAP_CONFIGURATION (again). Hence, we have to
// reload the newly written custom settings.php manually.
// bootstrap again. Hence, we have to reload the newly written custom
// settings.php manually.
$class_loader = require DRUPAL_ROOT . '/core/vendor/autoload.php';
Settings::initialize(DRUPAL_ROOT, $this->siteDirectory, $class_loader);
......
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