]> _ Git - cubist_net.git/commitdiff
wait #5867
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Apr 2023 09:17:27 +0000 (11:17 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 19 Apr 2023 09:17:27 +0000 (11:17 +0200)
src/SSH2.php

index 8a6af71268efba6003d3c07ea67cf73193d58699..90136a7fee2adfec1ea735c3e233e085bd9ab979 100644 (file)
@@ -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);
        }