function drush_bootstrap

8.0.x bootstrap.inc drush_bootstrap($phase, $phase_max = FALSE)
6.x bootstrap.inc drush_bootstrap($phase, $phase_max = FALSE)
7.x bootstrap.inc drush_bootstrap($phase, $phase_max = FALSE)
3.x environment.inc drush_bootstrap($phase)
4.x environment.inc drush_bootstrap($phase, $phase_max = FALSE)
5.x bootstrap.inc drush_bootstrap($phase, $phase_max = FALSE)
master bootstrap.inc drush_bootstrap($phase, $phase_max = FALSE)

Bootstrap Drush to the desired phase.

This function will sequentially bootstrap each lower phase up to the phase that has been requested.

Parameters

phase: The bootstrap phase to bootstrap to. Any of the following constants : DRUSH_BOOTSTRAP_DRUSH = Only Drush. DRUSH_BOOTSTRAP_DRUPAL_ROOT = Find a valid Drupal root. DRUSH_BOOTSTRAP_DRUPAL_SITE = Find a valid Drupal site. DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION = Load the site's settings. DRUSH_BOOTSTRAP_DRUPAL_DATABASE = Initialize the database. DRUSH_BOOTSTRAP_DRUPAL_FULL = Initialize Drupal fully. DRUSH_BOOTSTRAP_DRUPAL_LOGIN = Log into Drupal with a valid user.

11 calls to drush_bootstrap()
drush_bootstrap_max in includes/environment.inc
Bootstrap to the highest level possible, without triggering any errors.
drush_core_help in commands/core/core.drush.inc
This is called if no command or an unknown command is entered.
drush_core_pre_site_install in commands/core/site_install.drush.inc
drush_core_site_install_db_spec in commands/core/site_install.drush.inc
drush_main in ./drush.php
The main Drush function.

... See full list

File

includes/environment.inc, line 158
Functions used by drush to query the environment and setting the current configuration.

Code

function drush_bootstrap($phase) {
  static $phases;
  if (!$phases) {
    $phases = _drush_bootstrap_phases(TRUE);
  }
  static $phase_index = 0;

  drush_set_context('DRUSH_BOOTSTRAPPING', TRUE);
  while ($phase >= $phase_index && isset($phases[$phase_index])) {
    if (drush_bootstrap_validate($phase_index)) {
      $current_phase = $phases[$phase_index];
      if (function_exists($current_phase) && !drush_get_error()) {
        drush_log(dt("Drush bootstrap phase : !function()", array('!function' => $current_phase)), 'bootstrap');
        $current_phase();
      }
      drush_set_context('DRUSH_BOOTSTRAP_PHASE', $phase_index);
    }
    else {
      $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
      foreach ($errors as $code => $message) {
        drush_set_error($code, $message);
      }
    }
    unset($phases[$phase_index++]);
  }
  drush_set_context('DRUSH_BOOTSTRAPPING', FALSE);

  return !drush_get_error();
}