function drush_sitealias_create_self_alias

8.0.x sitealias.inc drush_sitealias_create_self_alias()
6.x sitealias.inc drush_sitealias_create_self_alias()
7.x sitealias.inc drush_sitealias_create_self_alias()
master sitealias.inc drush_sitealias_create_self_alias()

Check to see if a '@self' record was created during bootstrap. If not, make one now.

2 calls to drush_sitealias_create_self_alias()
drush_preflight_site in includes/preflight.inc
_drush_bootstrap_selected_uri in includes/bootstrap.inc
Find the URI that has been selected by the cwd if it was not previously set via the --uri / -l option

File

includes/sitealias.inc, line 96
The site alias API.

Code

function drush_sitealias_create_self_alias() {
  $self_record = drush_sitealias_get_record('@self');
  if (!array_key_exists('root', $self_record) && !array_key_exists('remote-host', $self_record)) {
    $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
    $uri = drush_get_context('DRUSH_SELECTED_URI');
    if (!empty($drupal_root) && !empty($uri)) {
      // Create an alias '@self'
      _drush_sitealias_cache_alias('@self', array('root' => $drupal_root, 'uri' => $uri));
    }
  }
}