function _drush_sitealias_initialize_alias_record

8.0.x _drush_sitealias_initialize_alias_record(&$alias_record)
6.x _drush_sitealias_initialize_alias_record(&$alias_record)
7.x _drush_sitealias_initialize_alias_record(&$alias_record)
3.x _drush_sitealias_initialize_alias_record(&$alias_record)
4.x _drush_sitealias_initialize_alias_record(&$alias_record)
5.x _drush_sitealias_initialize_alias_record(&$alias_record)
master _drush_sitealias_initialize_alias_record(&$alias_record)

Initialize an alias record; called as soon as the alias record is loaded from its alias file, before it is stored in the cache.


alias_record: The alias record to be initialized; parameter is modified in place.

2 calls to _drush_sitealias_initialize_alias_record()
_drush_sitealias_find_and_load_alias_from_file in includes/
_drush_sitealias_find_and_load_all_aliases in includes/
Worker function called by _drush_sitealias_load_alias and drush_sitealias_load_all. Traverses the alias search path and finds the specified alias record.


includes/, line 1201
The site alias API.


function _drush_sitealias_initialize_alias_record(&$alias_record) {
  // If there is a 'from-list' entry, then build a derived
  // list based on the site list with the given name.
  if (array_key_exists('from-list', $alias_record)) {
    // danger of infinite loops... move to transient defaults?
    $from_record = drush_sitealias_get_record($alias_record['from-list']);
    $from_list = drush_sitealias_resolve_sitelist($from_record);
    $derived_list = array();
    foreach ($from_list as $one_record) {
      $derived_record = _drush_sitealias_derive_record($one_record, $alias_record);
      $derived_list[] = drush_sitealias_alias_record_to_spec($derived_record);

    $alias_record = array();
    if (!empty($derived_list)) {
      $alias_record['site-list'] = $derived_list;
  // If there is a 'site-search-path' entry, then build
  // a 'site-list' entry from all of the sites that can be
  // found in the search path.
  if (array_key_exists('site-search-path', $alias_record)) {
    // TODO:  Is there any point in merging the sites from
    // the search path with any sites already listed in the
    // 'site-list' entry?  For now we'll just overwrite.
    $search_path = $alias_record['site-search-path'];
    if (!is_array($search_path)) {
      $search_path = explode(',', $search_path);
    $found_sites = _drush_sitealias_find_local_sites($search_path);
    $alias_record['site-list'] = $found_sites;
    // The 'unordered-list' flag indicates that the order of the items in the site list is not stable.
    $alias_record['unordered-list'] = '1';
    // DEBUG: var_export($alias_record, FALSE);
  if (array_key_exists('site-list', $alias_record)) {
    if (!is_array($alias_record['site-list'])) {
      $alias_record['site-list'] = explode(',', $alias_record['site-list']);
  else {
    if (isset($alias_record['root']) && !isset($alias_recort['uri'])) {
      $alias_recort['uri'] = 'default';