function _drush_bootstrap_drupal_root

6.x bootstrap.inc _drush_bootstrap_drupal_root()
3.x environment.inc _drush_bootstrap_drupal_root()
4.x environment.inc _drush_bootstrap_drupal_root()
5.x bootstrap.inc _drush_bootstrap_drupal_root()

Bootstrap Drush with a valid Drupal Directory.

In this function, the pwd will be moved to the root of the Drupal installation.

The DRUSH_DRUPAL_ROOT context and the DRUPAL_ROOT constant are populated from the value that we determined during the validation phase.

We also now load the drushrc.php for this specific platform. We can now include files from the Drupal Tree, and figure out more context about the platform, such as the version of Drupal.

1 string reference to '_drush_bootstrap_drupal_root'
_drush_bootstrap_phases in includes/environment.inc
Helper function listing phases.

File

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

Code

function _drush_bootstrap_drupal_root() {
  $drupal_root = drush_set_context('DRUSH_DRUPAL_ROOT', drush_bootstrap_value('drupal_root'));
  define('DRUPAL_ROOT', $drupal_root);

  // Save original working dir case some command wants it.
  drush_set_context('DRUSH_OLDCWD', getcwd());

  chdir($drupal_root);
  drush_load_config('drupal');
  require_once (DRUPAL_ROOT . '/' . DRUSH_DRUPAL_BOOTSTRAP);
  $version = drush_set_context('DRUSH_DRUPAL_VERSION', drush_drupal_version());
  $major_version = drush_set_context('DRUSH_DRUPAL_MAJOR_VERSION', drush_drupal_major_version());

  drush_log(dt("Initialized Drupal !version root directory at !drupal_root", array("!version" => $version, '!drupal_root' => $drupal_root)));
}