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.

14 calls to drush_bootstrap()
commandUnitCase::testCommandVersionSpecific in tests/commandUnitTest.php
Assure that matching version-specific command files are loaded and others are ignored.
commandUnitCase::testGetCommands in tests/commandUnitTest.php
Assert that $command has interesting properties. Reference command by it's alias (dl) to assure that those aliases are built as expected.
drush_bootstrap_max in includes/bootstrap.inc
Bootstrap to the highest level possible, without triggering any errors.
drush_bootstrap_to_phase in includes/bootstrap.inc
Bootstrap to the specified phase.
drush_browse in commands/core/browse.drush.inc
Command callback.

... See full list

File

includes/bootstrap.inc, line 172
Drush bootstrapping code.

Code

function drush_bootstrap($phase, $phase_max = FALSE) {
  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();

        // Find any command files that are available during this bootstrap phase.
        _drush_find_commandfiles($phase_index, $phase_max);
      }
      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);
      }
      break;
    }
    unset($phases[$phase_index++]);
  }
  drush_set_context('DRUSH_BOOTSTRAPPING', FALSE);
  return !drush_get_error();
}