From f0203ae9addff45df5811cd5d68d64b77de829da Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Wed, 19 Apr 2023 11:17:27 +0200 Subject: [PATCH] wait #5867 --- src/SSH2.php | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/src/SSH2.php b/src/SSH2.php index 8a6af71..90136a7 100644 --- a/src/SSH2.php +++ b/src/SSH2.php @@ -120,6 +120,7 @@ class SSH2 { return true; } + /** * @param $local string * @param $remote string @@ -127,6 +128,33 @@ class SSH2 { * @return bool */ public function send($local, $remote, $mode = 0644) { + if (!file_exists($local)) { + throw new \Exception('Local file ' . $local . ' not found'); + } + $dir = dirname($remote); + $this->mkdir($dir); + $cmd = 'scp -P' . $this->getPort() . ' ' . $local . ' ' . $this->getUsername() . '@' . $this->getHost() . ':/' . ltrim($remote, '/'); + return `$cmd`; + } + + + /** + * @param $remote string + * @param $local string + * @return bool + */ + public function recv($remote, $local) { + $cmd = 'scp -P' . $this->getPort() . ' ' . $this->getUsername() . '@' . $this->getHost() . ':/' . ltrim($remote, '/') . ' ' . $local; + return `$cmd`; + } + + /** + * @param $local string + * @param $remote string + * @param $mode int + * @return bool + */ + public function slowsend($local, $remote, $mode = 0644) { if (!file_exists($local)) { throw new \Exception('Local file ' . $local . ' not found'); } @@ -149,7 +177,7 @@ class SSH2 { * @param $local string * @return bool */ - public function recv($remote, $local) { + public function slowrecv($remote, $local) { return $this->_copy($this->_filename($remote), $local, false); } -- 2.39.5