function _drush_bootstrap_select_drupal_site

6.x bootstrap.inc _drush_bootstrap_select_drupal_site()
5.x bootstrap.inc _drush_bootstrap_select_drupal_site()

Determine which Drupal site will be selected.

The Drupal site itself will be bootstrapped at a later phase; at this time, we set context variables to point to the drupal root, site URI and site configuration path that will be used when needed.

These early context variables are used to find drush configuration and alias files stored with the site to be bootstrapped.

2 calls to _drush_bootstrap_select_drupal_site()
drush_bootstrap_validate in includes/bootstrap.inc
Validate whether a bootstrap phase can be reached.
_drush_sitealias_set_context_by_name in includes/sitealias.inc
Looks up the specified alias record and calls through to drush_sitealias_set_alias_context, below.

File

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

Code

function _drush_bootstrap_select_drupal_site() {
  $drupal_root = drush_get_option('root');
  if (!isset($drupal_root)) {
    $drupal_root = drush_locate_root();
  }
  drush_set_context('DRUSH_SELECTED_DRUPAL_ROOT', $drupal_root);
  drush_set_context('DRUSH_SELECTED_DRUPAL_SITES_ALL_DRUSH', $drupal_root . '/sites/all/drush');
  $uri = _drush_bootstrap_selected_uri();
  drush_set_context('DRUSH_SELECTED_URI', $uri);
  drush_set_context('DRUSH_SELECTED_DRUPAL_SITE_CONF_PATH', drush_conf_path($uri));

  if (!empty($drupal_root) && !empty($uri)) {
    // Create an alias '@self'
    _drush_sitealias_cache_alias('self', array('root' => $drupal_root, 'uri' => $uri));
  }
}