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)
2 calls to _drush_sitealias_preflight_path()
drush_core_rsync in commands/core/rsync.core.inc
Entrypoint for drush rsync.
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 1290
The site alias API.

Code

function _drush_sitealias_preflight_path($path) {
  $alias = NULL;
  // Parse site aliases if there is a colon in the path
  $colon_pos = strpos($path, ':');
  if ($colon_pos !== FALSE) {
    $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,
  );
}