function drush_bootstrap_to_phase

8.0.x bootstrap.inc drush_bootstrap_to_phase($max_phase_index)
6.x bootstrap.inc drush_bootstrap_to_phase($max_phase_index)
7.x bootstrap.inc drush_bootstrap_to_phase($max_phase_index)
4.x environment.inc drush_bootstrap_to_phase($max_phase_index)
5.x bootstrap.inc drush_bootstrap_to_phase($max_phase_index)
master bootstrap.inc drush_bootstrap_to_phase($max_phase_index)

Bootstrap to the specified phase.

Parameters

$max_phase_index: Only attempt bootstrap to the specified level.

1 call to drush_bootstrap_to_phase()
drush_main in ./drush.php
The main Drush function.

File

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

Code

function drush_bootstrap_to_phase($max_phase_index) {
  // If $max_phase_index is DRUSH_BOOTSTRAP_MAX, then
  // we will bootstrap as far as we can.  drush_bootstrap_max
  // is different than drush_bootstrap_to_phase in that
  // it is not an error if DRUSH_BOOTSTRAP_LOGIN is not reached.
  if ($max_phase_index == DRUSH_BOOTSTRAP_MAX) {
    drush_bootstrap_max();
    return TRUE;
  }

  drush_log(dt("Bootstrap to phase !phase.", array('!phase' => $max_phase_index)), 'bootstrap');
  $phases = _drush_bootstrap_phases();
  $result = TRUE;

  // Try to bootstrap to the maximum possible level, without generating errors
  foreach ($phases as $phase_index) {
    if ($phase_index > $max_phase_index) {
      // Stop trying, since we achieved what was specified.
      break;
    }

    if (drush_bootstrap_validate($phase_index)) {
      if ($phase_index > drush_get_context('DRUSH_BOOTSTRAP_PHASE')) {
        $result = drush_bootstrap($phase_index, $max_phase_index);
      }
    }
    else {
      break;
    }
  }

  return $result;
}