Merge pull request #1264 from Exotherme/uploadAndDownloadUndefinedIndexNotice

Upload and download undefined index notice
This commit is contained in:
Anton Medvedev 2017-06-16 23:58:49 +07:00 committed by GitHub
commit b654659f54

View File

@ -423,13 +423,15 @@ function upload($source, $destination, array $config = [])
$host = Context::get()->getHost();
$source = parse($source);
$destination = parse($destination);
$config['options'] = is_array($config['options']) ? $config['options'] : [];
if ($host instanceof Localhost) {
$rsync->call($host->getHostname(), $source, $destination, $config);
} else {
$sshArguments = $host->getSshArguments()->getCliArguments();
if (empty($sshArguments) === false) {
if (!isset($config['options']) || !is_array($config['options'])) {
$config['options'] = [];
}
$config['options'][] = "-e 'ssh $sshArguments'";
}
$rsync->call($host->getHostname(), $source, "$host:$destination", $config);
@ -449,13 +451,15 @@ function download($source, $destination, array $config = [])
$host = Context::get()->getHost();
$source = parse($source);
$destination = parse($destination);
$config['options'] = is_array($config['options']) ? $config['options'] : [];
if ($host instanceof Localhost) {
$rsync->call($host->getHostname(), $source, $destination, $config);
} else {
$sshArguments = $host->getSshArguments()->getCliArguments();
if (empty($sshArguments) === false) {
if (!isset($config['options']) || !is_array($config['options'])) {
$config['options'] = [];
}
$config['options'][] = "-e 'ssh $sshArguments'";
}
$rsync->call($host->getHostname(), "$host:$source", $destination, $config);