function drush_get_runner

8.0.x sitealias.inc drush_get_runner($source, $destination)
master sitealias.inc drush_get_runner($source, $destination, $runner = FALSE)

Decide on which side to run a core-rsync.

Parameters

$source:

$destination:

$runner Where to run the rsync operation: 'destination', 'source',: 'auto' ('destination' if both are remote, otherwise '@self') or FALSE (@self)

Return value

mixed

2 calls to drush_get_runner()
drush_config_pull in commands/core/config.drush.inc
Config pull command callback
drush_sqlsync_sql_sync in commands/sql/sqlsync.drush.inc

File

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

Code

function drush_get_runner($source, $destination, $runner = FALSE) {
  if (is_string($source)) {
    $source = drush_sitealias_get_record($site);
  }
  if (is_string($destination)) {
    $destination = drush_sitealias_get_record($destination);
  }

  // If both sites are remote, and --runner=auto, then we'll use the destination site.
  if (drush_sitealias_is_remote_site($source) && drush_sitealias_is_remote_site($destination)) {
    if ($runner == 'auto') {
      $runner = 'destination';
    }
  }

  // If the user explicitly requests a remote site, then return the selected one.
  if ($runner == 'destination') {
    return "@" . $destination['#name'];
  }
  if ($runner == 'source') {
    return "@" . $source['#name'];
  }

  // Default to running rsync locally. When in doubt, local is best, because
  // we can always resolve aliases here.
  return '@self';
}