From: Vincent Vanwaelscappel Date: Wed, 19 Apr 2023 09:17:27 +0000 (+0200) Subject: wait #5867 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=f0203ae9addff45df5811cd5d68d64b77de829da;p=cubist_net.git wait #5867 --- 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); }