function drush_bootstrap_max

8.0.x drush_bootstrap_max($max_phase_index = FALSE)
6.x drush_bootstrap_max($max_phase_index = FALSE)
7.x drush_bootstrap_max($max_phase_index = FALSE)
3.x drush_bootstrap_max()
4.x drush_bootstrap_max($max_phase_index = FALSE)
5.x drush_bootstrap_max($max_phase_index = FALSE)
master drush_bootstrap_max($max_phase_index = FALSE)

Bootstrap to the highest level possible, without triggering any errors.


int $max_phase_index: (optional) Only attempt bootstrap to the specified level.

Return value

int The maximum phase to which we bootstrapped.

25 calls to drush_bootstrap_max()
cache_cache_clear_complete in commands/core/
Command argument complete callback.
core_site_install_complete in commands/core/
Command argument complete callback.
drush_bootstrap_max_to_sitealias in includes/
Bootstrap the specified site alias. The site alias must be a valid alias to a local site.
drush_bootstrap_to_phase in includes/
Bootstrap to the specified phase.
drush_COMMAND_init in ./drush.api.php
Initialize a command prior to validation.

... See full list


includes/, line 364


function drush_bootstrap_max($max_phase_index = FALSE) {
  $phases = _drush_bootstrap_phases(TRUE);
  if (!$max_phase_index) {
    $max_phase_index = count($phases);

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

    if (drush_bootstrap_validate($phase_index)) {
      if ($phase_index > drush_get_context('DRUSH_BOOTSTRAP_PHASE')) {
        drush_bootstrap($phase_index, $max_phase_index);
    else {
      // drush_bootstrap_validate() only logs successful validations. For us,
      // knowing what failed can also be important.
      $previous = drush_get_context('DRUSH_BOOTSTRAP_PHASE');
      drush_log(dt("Bootstrap phase !function() failed to validate; continuing at !current().", array('!function' => $current_phase, '!current' => $phases[$previous])), 'debug');

  return drush_get_context('DRUSH_BOOTSTRAP_PHASE');