function _drush_sitealias_preflight_path

8.0.x sitealias.inc _drush_sitealias_preflight_path($path)
6.x sitealias.inc _drush_sitealias_preflight_path($path)
7.x sitealias.inc _drush_sitealias_preflight_path($path)
3.x sitealias.inc _drush_sitealias_preflight_path($path)
4.x sitealias.inc _drush_sitealias_preflight_path($path)
5.x sitealias.inc _drush_sitealias_preflight_path($path)
master sitealias.inc _drush_sitealias_preflight_path($path)

Call prior to drush_sitealias_evaluate_path to insure that any site-specific aliases associated with any local site in $path are defined.

2 calls to _drush_sitealias_preflight_path()
drush_core_rsync in commands/core/rsync.core.inc
A command callback.
drush_sitealias_evaluate_path in includes/sitealias.inc
Evaluate a path from its shorthand form to a literal path usable by rsync.

File

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

Code

function _drush_sitealias_preflight_path($path) {
  $alias = NULL;
  // Parse site aliases if there is a colon in the path
  // We allow:
  //   @alias:/path
  //   machine.domain.com:/path
  //   machine:/path
  // Note that paths in the form "c:/path" are converted to
  // "/cygdrive/c/path" later; we do not want them to confuse
  // us here, so we skip paths that start with a single character
  // before the colon if we are running on Windows.  Single-character
  // machine names are allowed in Linux only.
  $colon_pos = strpos($path, ':');
  if ($colon_pos > (drush_is_windows("LOCAL") ? 1 : 0)) {
    $alias = substr($path, 0, $colon_pos);
    $path = substr($path, $colon_pos + 1);
    $site_alias_settings = drush_sitealias_get_record($alias);
    if (empty($site_alias_settings) && (substr($path, 0, 1) == '@')) {
      return NULL;
    }
    $machine = $alias;
  }
  else {
    $machine = '';
    // if the path is a site alias or a local site...
    $site_alias_settings = drush_sitealias_get_record($path);
    if (empty($site_alias_settings) && (substr($path, 0, 1) == '@')) {
      return NULL;
    }
    if (!empty($site_alias_settings) || drush_is_local_host($path)) {
      $alias = $path;
      $path = '';
    }
  }
  return array(
    'alias' => $alias,
    'path' => $path,
    'machine' => $machine,
  );
}