function drush_sitealias_simplify_names

8.0.x sitealias.inc drush_sitealias_simplify_names($site_list)
6.x sitealias.inc drush_sitealias_simplify_names($site_list)
7.x sitealias.inc drush_sitealias_simplify_names($site_list)
4.x sitealias.inc drush_sitealias_simplify_names($site_list)
5.x sitealias.inc drush_sitealias_simplify_names($site_list)
master sitealias.inc drush_sitealias_simplify_names($site_list)

Given a list of alias records, shorten the name used if possible

1 call to drush_sitealias_simplify_names()
drush_invoke_process in includes/command.inc
Invoke a command in a new process, targeting the site specified by the provided site alias record.

File

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

Code

function drush_sitealias_simplify_names($site_list) {
  $result = array();
  foreach ($site_list as $original_name => $alias_record) {
    $adjusted_name = $alias_record['#name'];
    $hashpos = strpos($original_name, '#');
    if ($hashpos !== FALSE) {
      $adjusted_name = substr($original_name, $hashpos);
      if (array_key_exists('remote-host', $alias_record)) {
        $adjusted_name = $alias_record['remote-host'] . $adjusted_name;
      }
    }
    $result[$adjusted_name] = $alias_record;
  }
  return $result;
}