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_print_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 703
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 (($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)) {
      // Make sure that we are bootstrapped at least to the 'site'
      // level, and include file.inc to insure that we have access
      // to the %file path.
      if (drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_SITE)) {
        include_once DRUPAL_ROOT . '/includes/file.inc';
      }
      $status_values = _core_site_status_table($project_list);
    }
    else {
      $values = drush_invoke_sitealias_args($alias_record, "status", array(), empty($project_list) ? array() : array('project' => $project_list));
      $status_values = $values['object'];
    }
    if (isset($status_values['%paths'])) {
      foreach ($status_values['%paths'] as $key => $path) {
        $alias_record['path-aliases'][$key] = $path;
      }
    }
  }
}