function drush_bootstrap_max

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

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

Parameters

$max_phase_index: Only attempt bootstrap to the specified level.

9 calls to drush_bootstrap_max()
drush_bootstrap_max_to_sitealias in includes/environment.inc
Bootstrap the specified site alias. The site alias must be a valid alias to a local site.
drush_bootstrap_to_phase in includes/environment.inc
Bootstrap to the specified phase.
drush_COMMAND_init in docs/drush.api.php
Initialize a command prior to validation. If a command needs to bootstrap to a higher level, this is best done in the command init hook. It is permisible to bootstrap in any hook, but note that if bootstrapping adds more commandfiles (*.drush.inc)…
drush_core_help in commands/core/help.drush.inc
Command callback for help command. This is the default command, when none other has been specified.
drush_print_help in includes/drush.inc
Print the help for a single command to the screen.

... See full list

File

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

Code

function drush_bootstrap_max($max_phase_index = FALSE) {
  $phases = _drush_bootstrap_phases();
  $phase_index = DRUSH_BOOTSTRAP_DRUSH;
  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) {
    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($phase_index, $max_phase_index);
      }
    }
    else {
      break;
    }
  }

  return drush_get_context('DRUSH_BOOTSTRAP_PHASE');
}