function drush_bootstrap_validate

8.0.x drush_bootstrap_validate($phase)
6.x drush_bootstrap_validate($phase)
7.x drush_bootstrap_validate($phase)
3.x drush_bootstrap_validate($phase)
4.x drush_bootstrap_validate($phase)
5.x drush_bootstrap_validate($phase)
master drush_bootstrap_validate($phase)

Validate whether a bootstrap phases can be reached.

This function will validate the settings that will be used during the actual bootstrap process, and allow commands to progressively bootstrap to the highest level that can be reached.

This function will only run the validation function once, and store the result from that execution in a local static. This avoids validating phases multiple times.


phase: The bootstrap phase to validate to. Any of the following constants : DRUSH_BOOTSTRAP_DRUSH = Only Drush. DRUSH_BOOTSTRAP_DRUPAL_ROOT = Find a valid Drupal root. DRUSH_BOOTSTRAP_DRUPAL_SITE = Find a valid Drupal site. DRUSH_BOOTSTRAP_DRUPAL_CONFIGURATION = Load the site's settings. DRUSH_BOOTSTRAP_DRUPAL_DATABASE = Initialize the database. DRUSH_BOOTSTRAP_DRUPAL_FULL = Initialize Drupal fully. DRUSH_BOOTSTRAP_DRUPAL_LOGIN = Log into Drupal with a valid user.

Return value

True if bootstrap is possible, False if the validation failed.

4 calls to drush_bootstrap_validate()
drush_bootstrap in includes/
Bootstrap Drush to the desired phase.
drush_bootstrap_max in includes/
Bootstrap to the highest level possible, without triggering any errors.
drush_core_help in commands/core/
This is called if no command or an unknown command is entered.
drush_show_help in includes/
Prints out help for a given command.


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


function drush_bootstrap_validate($phase) {
  static $phases;
  static $result_cache = array();
  if (!$phases) {
    $phases = _drush_bootstrap_phases(TRUE);
  static $phase_index = 0;
  if (!array_key_exists($phase, $result_cache)) {
    drush_set_context('DRUSH_BOOTSTRAP_ERRORS', array());
    drush_set_context('DRUSH_BOOTSTRAP_VALUES', array());

    while ($phase >= $phase_index && isset($phases[$phase_index])) {
      $current_phase = $phases[$phase_index] . '_validate';
      if (function_exists($current_phase)) {
        $result_cache[$phase_index] = $current_phase();
      else {
        $result_cache[$phase_index] = TRUE;
      drush_set_context('DRUSH_BOOTSTRAP_VALIDATION_PHASE', $phase_index);
  return $result_cache[$phase];