function drush_sitealias_resolve_path_references

8.0.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
6.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
7.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
3.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
4.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
5.x sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')
master sitealias.inc drush_sitealias_resolve_path_references(&$alias_record, $test_string = '')

If there are any path aliases (items beginning with "%") in the test string, then resolve them as path aliases and add them to the provided alias record.

Parameters

$alias_record: The full alias record to use in path alias expansion

$test_string: A slash-separated list of path aliases to resolve e.g. "%files/%special".

2 calls to drush_sitealias_resolve_path_references()
drush_sitealias_evaluate_path in includes/sitealias.inc
Evaluate a path from its shorthand form to a literal path usable by rsync.
_drush_sitealias_prepare_record in commands/core/sitealias.drush.inc
Given a site alias name, print out a php-syntax representation of it.

File

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

Code

function drush_sitealias_resolve_path_references(&$alias_record, $test_string = '') {
  $path_aliases = array_key_exists('path-aliases', $alias_record) ? $alias_record['path-aliases'] : array();
  // Convert the test string into an array of items, and
  // from this make a comma-separated list of projects
  // that we can pass to 'drush status'.
  $test_array = explode('/', $test_string);
  $project_array = array();
  foreach ($test_array as $one_item) {
    if (!empty($one_item) && ($one_item[0] == '%') && (!array_key_exists($one_item, $path_aliases))) {
      $project_array[] = substr($one_item, 1);
    }
  }
  $project_list = implode(',', $project_array);

  if (!empty($project_array)) {
    // Optimization:  if we're already bootstrapped to the
    // site specified by $alias_record, then we can just
    // call _core_site_status_table() rather than use backend invoke.
    if (drush_sitealias_is_bootstrapped_site($alias_record) && drush_has_boostrapped(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
      $status_values = _core_site_status_table($project_list);
    }
    else {
      $values = drush_invoke_process($alias_record, "core-status", array(), empty($project_list) ? array() : array('project' => $project_list), array('integrate' => FALSE, 'override-simulated' => TRUE));
      $status_values = $values['object'];
    }
    if (isset($status_values['%paths'])) {
      foreach ($status_values['%paths'] as $key => $path) {
        $alias_record['path-aliases'][$key] = $path;
      }
    }
    // If 'root' is not set in the alias, then fill it in from the status values.
    if (!isset($alias_record['root']) && isset($status_values['root'])) {
      $alias_record['root'] = $status_values['root'];
    }
  }
}