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, DRUSH_DRUPAL_CORE context, DRUPAL_ROOT, and the DRUSH_DRUPAL_CORE constants 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/bootstrap.inc
Helper function listing phases.

File

includes/bootstrap.inc, line 697
Drush bootstrapping code.

Code

function _drush_bootstrap_drupal_root() {
  $drupal_root = drush_get_context('DRUSH_DRUPAL_ROOT');
  chdir($drupal_root);
  $version = drush_drupal_version();
  $major_version = drush_drupal_major_version();

  define('DRUPAL_ROOT', $drupal_root);

  // DRUSH_DRUPAL_CORE should point to the /core folder in Drupal 8+ or to DRUPAL_ROOT
  // in prior versions.
  $core = $major_version >= 8 ? DRUPAL_ROOT . '/core' : DRUPAL_ROOT;
  drush_set_context('DRUSH_DRUPAL_CORE', $core);
  define('DRUSH_DRUPAL_CORE', $core);

  _drush_bootstrap_global_options();

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