function _drush_sitealias_cache_alias

8.0.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
6.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
7.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
3.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
4.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
5.x sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)
master sitealias.inc _drush_sitealias_cache_alias($alias_name, $alias_record)

Add an empty record for the specified alias name

Parameters

$alias_name: The name of the alias, including the leading "@"

7 calls to _drush_sitealias_cache_alias()
drush_sitealias_create_self_alias in includes/sitealias.inc
Check to see if a '@self' record was created during bootstrap. If not, make one now.
drush_sitealias_create_sites_alias in includes/sitealias.inc
_drush_bootstrap_drush in includes/bootstrap.inc
Initial Drush bootstrap phase.
_drush_bootstrap_select_drupal_site in includes/bootstrap.inc
Determine which Drupal site will be selected.
_drush_sitealias_add_inherited_values in includes/sitealias.inc
Check to see if there is a 'parent' item in the alias; if there is, then load the parent alias record and overlay the entries in the current alias record on top of the items from the parent record.

... See full list

File

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

Code

function _drush_sitealias_cache_alias($alias_name, $alias_record) {
  $cache = &drush_get_context('site-aliases');
  // If the alias already exists in the cache, then merge
  // the new alias with the existing alias
  if (array_key_exists($alias_name, $cache)) {
    $alias_record = array_merge($cache[$alias_name], $alias_record);
  }
  if (!isset($alias_record['#name'])) {
    $alias_record['#name'] = trim($alias_name, '@');
  }
  $cache[$alias_name] = $alias_record;

  // If the alias record points at a local site, make sure
  // that /drush, /sites/all/drush and the site folder for that site
  // are added to the alias path, so that other alias files
  // stored in those locations become searchable.
  if (!array_key_exists('remote-host', $alias_record) && !empty($alias_record['root'])) {
    drush_sitealias_add_to_alias_path($alias_record['root'] . '/drush');
    drush_sitealias_add_to_alias_path($alias_record['root'] . '/sites/all/drush');
    $site_dir = drush_sitealias_local_site_path($alias_record);
    if (isset($site_dir)) {
      drush_sitealias_add_to_alias_path($site_dir);
    }
  }
}