function _drush_bootstrap_drupal_root

6.x _drush_bootstrap_drupal_root()
3.x _drush_bootstrap_drupal_root()
4.x _drush_bootstrap_drupal_root()
5.x _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/
Helper function listing phases.


includes/, line 684
Drush bootstrapping code.


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

  // Beware the poison pill: prefer drush_drupal_version() and
  // drush_drupal_major_version() to 'DRUSH_DRUPAL_VERSION' and
  // 'DRUSH_DRUPAL_MAJOR_VERSION', respectively. See
  $version = drush_set_context('DRUSH_DRUPAL_VERSION', drush_drupal_version());
  $major_version = drush_set_context('DRUSH_DRUPAL_MAJOR_VERSION', drush_drupal_major_version());

  if (($major_version < 6) || ($major_version > 7)) {
    if ($major_version < 6) {
      $recommended_version = 4;
    else {
      $recommended_version = 6;
    drush_set_error('DRUSH_DRUPAL_VERSION_UNSUPPORTED', dt('Drush !drush_version does not support Drupal !major_version. Use Drush !recommended_version instead.', array('!drush_version' => DRUSH_VERSION, '!major_version' => $major_version, '!recommended_version' => $recommended_version)));

  drush_set_context('DRUSH_DRUPAL_CORE', DRUPAL_ROOT);


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