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. @see \Drush\Boot::bootstrap_phases

10 calls to drush_bootstrap()
drush_bootstrap_max in includes/
Bootstrap to the highest level possible, without triggering any errors.
drush_bootstrap_to_phase in includes/
Bootstrap to the specified phase.
drush_browse in commands/core/
Command callback.
drush_core_pre_site_install in commands/core/
Perform setup tasks for installation.
drush_core_site_install_version in commands/core/drupal/
Install Drupal 6.x

... See full list


includes/, line 285


function drush_bootstrap($phase, $phase_max = FALSE) {
  $bootstrap = drush_get_bootstrap_object();
  $phases = _drush_bootstrap_phases(TRUE);
  $result = TRUE;

  // If the requested phase does not exist in the list of available
  // phases, it means that the command requires bootstrap to a certain
  // level, but no site root could be found.
  if (!isset($phases[$phase])) {
    $result = drush_bootstrap_error('DRUSH_NO_SITE', dt("We could not find an applicable site for that command."));

  // Once we start bootstrapping past the DRUSH_BOOTSTRAP_DRUSH phase, we
  // will latch the bootstrap object, and prevent it from changing.
  if ($phase > DRUSH_BOOTSTRAP_DRUSH) {

  drush_set_context('DRUSH_BOOTSTRAPPING', TRUE);
  foreach ($phases as $phase_index => $current_phase) {
    $bootstrapped_phase = drush_get_context('DRUSH_BOOTSTRAP_PHASE', -1);
    if ($phase_index > $phase) {
    if ($phase_index > $bootstrapped_phase) {
      if ($result = drush_bootstrap_validate($phase_index)) {
        if (method_exists($bootstrap, $current_phase) && !drush_get_error()) {
          drush_log(dt("Drush bootstrap phase : !function()", array('!function' => $current_phase)), LogLevel::BOOTSTRAP);

          // Reset commandfile cache and find any new command files that are available during this bootstrap phase.
          _drush_find_commandfiles($phase_index, $phase_max);
        drush_set_context('DRUSH_BOOTSTRAP_PHASE', $phase_index);
  drush_set_context('DRUSH_BOOTSTRAPPING', FALSE);
  if (!$result || drush_get_error()) {
    $errors = drush_get_context('DRUSH_BOOTSTRAP_ERRORS', array());
    foreach ($errors as $code => $message) {
      drush_set_error($code, $message);
  return !drush_get_error();