function _drush_sitealias_initialize_alias_record

8.0.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
6.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
7.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
3.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
4.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
5.x sitealias.inc _drush_sitealias_initialize_alias_record(&$alias_record)
master sitealias.inc _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.

Parameters

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

1 call to _drush_sitealias_initialize_alias_record()
_drush_sitealias_find_and_load_alias in includes/sitealias.inc
Worker function called by _drush_sitealias_load_alias and drush_sitealias_load_all. Traverses the alias search path and finds the specified alias record.

File

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

Code

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']);
    }
  }
}