mirror of
https://github.com/deployphp/deployer.git
synced 2025-02-22 16:27:39 +01:00
Add download features
This commit is contained in:
parent
6dd055d72d
commit
14862f10d3
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,3 +2,4 @@ vendor/
|
||||
deployer.phar
|
||||
pages/
|
||||
.idea/
|
||||
/nbproject/
|
||||
|
@ -59,4 +59,14 @@ class Remote implements RemoteInterface
|
||||
}
|
||||
$this->sftp->put($to, $from, NET_SFTP_LOCAL_FILE);
|
||||
}
|
||||
|
||||
/**
|
||||
* download file from remote in current directory
|
||||
* @param type $from
|
||||
* @param type $to
|
||||
*/
|
||||
public function downloadFile($from, $to)
|
||||
{
|
||||
return $this->sftp->get($from, $to);
|
||||
}
|
||||
}
|
@ -185,6 +185,20 @@ class Tool
|
||||
}
|
||||
}
|
||||
|
||||
public function download($remote, $local)
|
||||
{
|
||||
$this->checkConnected();
|
||||
|
||||
$this->writeln("Downloading file <info>$remote</info> to <info>$local</info>");
|
||||
$status = $this->remote->downloadFile($remote , $local );
|
||||
|
||||
if (!$status) {
|
||||
throw new \RuntimeException("Download error");
|
||||
}
|
||||
|
||||
$this->writeln("Download complete");
|
||||
}
|
||||
|
||||
public function cd($directory)
|
||||
{
|
||||
$this->checkConnected();
|
||||
|
@ -80,6 +80,17 @@ function upload($from, $to)
|
||||
Context::get()->upload($from, $to);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type $from
|
||||
* @param type $to
|
||||
*/
|
||||
function download($from, $to)
|
||||
{
|
||||
Context::get()->download($from, $to);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change current directory for whole connect session.
|
||||
* @param string $directory
|
||||
|
Loading…
x
Reference in New Issue
Block a user