function _drush_bootstrap_redo_drupal_site

3.x environment.inc _drush_bootstrap_redo_drupal_site()
4.x environment.inc _drush_bootstrap_redo_drupal_site()

Re-do the drupal site bootstrap (and possibly the drupal root bootstrap) if a site alias was processed after the site bootstrap phase completed. This will happen when processing "drush sitealias command" for a site alias defined in a drushrc.php file in the default site's drush configuration directory.

1 call to _drush_bootstrap_redo_drupal_site()
_drush_bootstrap_drupal_site in includes/environment.inc
Initialize a site on the Drupal root.

File

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

Code

function _drush_bootstrap_redo_drupal_site() {
  // If drush_load_config defined a site alias that did not
  // exist before, then sitealias check arg might now match
  // against one of those aliases.
  if (drush_sitealias_check_arg() === TRUE) {
    $remote_host = drush_get_option('remote-host');
    if (!isset($remote_host)) {
      // Check to see if the drupal root changed.
      // If it has, we will set remote-host to cause
      // this command to be executed via the backend invoke
      // process.
      $sitealias_drupal_root = drush_get_option(array('r', 'root'));
      if (($sitealias_drupal_root != null) && (DRUPAL_ROOT != $sitealias_drupal_root)) {
        drush_set_option('remote-host', 'localhost');
      }
      else {
        // If we set an alias, then we need to bootstrap the
        // drupal site once again.  It is possible to re-bootstrap
        // the site at this point because settings.php has not
        // been included yet.
        drush_log(dt("Re-bootstrap drupal site."));
        _drush_bootstrap_drupal_site_validate();
        _drush_bootstrap_do_drupal_site();
      }
    }
  }
}