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.

5 calls to drush_bootstrap_to_phase()
BaseBoot::bootstrap_and_dispatch in lib/Drush/Boot/BaseBoot.php
Main entrypoint to bootstrap the selected CMS and execute the selected command.
drush_core_quick_drupal in commands/core/core.drush.inc
Callback for core-quick-drupal command.
update_main in commands/core/drupal/update.inc
_drush_core_directory in commands/core/core.drush.inc
Given a target (e.g. @site:%modules), return the evaluated directory path.
_update_batch_command in commands/core/drupal/update.inc

File

includes/bootstrap.inc, line 430

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)), LogLevel::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', DRUSH_BOOTSTRAP_NONE)) {
        $result = drush_bootstrap($phase_index, $max_phase_index);
      }
    }
    else {
      $result = FALSE;
      break;
    }
  }

  return $result;
}