function drush_bootstrap

8.0.x drush_bootstrap($phase, $phase_max = FALSE)
6.x drush_bootstrap($phase, $phase_max = FALSE)
7.x drush_bootstrap($phase, $phase_max = FALSE)
3.x drush_bootstrap($phase)
4.x drush_bootstrap($phase, $phase_max = FALSE)
5.x drush_bootstrap($phase, $phase_max = FALSE)
master 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.


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/
Bootstrap to the highest level possible, without triggering any errors.
drush_core_help in commands/core/
This is called if no command or an unknown command is entered.
drush_core_pre_site_install in commands/core/
drush_core_site_install_db_spec in commands/core/
drush_main in ./drush.php
The main Drush function.

... See full list


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


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');
      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);
  drush_set_context('DRUSH_BOOTSTRAPPING', FALSE);

  return !drush_get_error();