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 "@"

5 calls to _drush_sitealias_cache_alias()
drush_preflight in includes/preflight.inc
During the initialization of Drush, this is the first step where we load our configuration and commandfiles, and select the site we are going to operate on; however, we take no irreversible actions (e.g. site bootstrapping). This allows commands that…
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_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.
_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/sitealias.inc, line 831
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);
    }
  }
}