]> _ Git - cubist_net.git/commitdiff
wait #7239 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 20 Dec 2024 11:43:44 +0000 (12:43 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 20 Dec 2024 11:43:44 +0000 (12:43 +0100)
src/Server/SFTP.php
src/Transfer/Driver.php
src/Transfer/FTP.php
src/Transfer/Local.php
src/Transfer/S3.php
src/Transfer/SFTP.php

index b653056ed5d1fa7c91d98e802c54cd57394786bc..06992f76b2d1c3095f7b068399268150eb0b2085 100644 (file)
@@ -66,4 +66,34 @@ class SFTP implements IServer
     {
         // TODO: Implement makeURL() method.
     }
-}
\ No newline at end of file
+
+    public function getRegion()
+    {
+        // TODO: Implement getRegion() method.
+    }
+
+    public function getAccessKey()
+    {
+        // TODO: Implement getAccessKey() method.
+    }
+
+    public function getSecret()
+    {
+        // TODO: Implement getSecret() method.
+    }
+
+    public function getEndpoint()
+    {
+        // TODO: Implement getEndpoint() method.
+    }
+
+    public function getBucket()
+    {
+        // TODO: Implement getBucket() method.
+    }
+
+    public function getS3Provider()
+    {
+        // TODO: Implement getS3Provider() method.
+    }
+}
index 0561b161140618f60c4cbf455b99540a40bf727a..ec7cd9603c4fd3973443de519fc65266745535c1 100644 (file)
@@ -12,10 +12,11 @@ abstract class Driver
      * @var IServer
      */
     protected $_server;
+    public $checkConnection = true;
 
-    public function __construct(IServer $server)
+    public function __construct(IServer $server, $checkConnection = true)
     {
-
+        $this->checkConnection = $checkConnection;
         $this->setServer($server);
     }
 
@@ -71,4 +72,4 @@ abstract class Driver
     {
         return $this->synchronizeFiles($source, $dest);
     }
-}
\ No newline at end of file
+}
index 9bfbaabe755fae3c084992b9b529a479b8d792bb..f15cb5e9aa570d86659248c055634c450202e838 100644 (file)
@@ -34,7 +34,9 @@ class FTP extends Driver
 
     public function checkConnexion($data = [])
     {
-
+        if(!$this->checkConnection){
+            return true;
+        }
         $data['port'] = $data['port'] ?? $this->port;
         $data = [
             'username' => $data['username'] ?? $this->getServer()->getUsername(),
@@ -86,4 +88,4 @@ class FTP extends Driver
         $filepath = explode('/', $file);
         return end($filepath);
     }
-}
\ No newline at end of file
+}
index beb00a2f141514a8ae48b33cb74188b659e73e15..eb3866e3d53c25c8a0aaca41c31e2c05cf9669ec 100644 (file)
@@ -77,6 +77,9 @@ class Local extends Driver
 
     public function checkConnexion($data = [])
     {
+        if(!$this->checkConnection){
+            return true;
+        }
         if (file_exists($this->getRootPath() . 'status')) {
             return true;
         } else {
@@ -84,4 +87,4 @@ class Local extends Driver
         }
     }
 
-}
\ No newline at end of file
+}
index 798abe7a7e9e037f3e9da7922ac5def6400277d7..ce8ba57d721fb394ba54dc84a58bb388533db260 100644 (file)
@@ -23,6 +23,9 @@ class S3 extends Driver
 
     public function checkConnexion($data = [])
     {
+       if(!$this->checkConnection){
+           return true;
+       }
         $client = $this->createClient($data);
 
         $test = 'test' . time() . '-' . rand(1, 1000000);
index a3bce4c3eae42bf1c32efb75825874a9909589ab..54c1ee15dd6239d1d8485d581168dbf6aa8a4a49 100644 (file)
@@ -4,7 +4,6 @@ namespace Cubist\Net\Transfer;
 
 use Cubist\Util\CommandLine\Rclone;
 use Cubist\Util\Files\Files;
-use Illuminate\Support\Facades\Log;
 
 class SFTP extends Driver
 {
@@ -19,9 +18,10 @@ class SFTP extends Driver
 
     const DEFAULT_PORT = 22;
 
-    public static function getInstance($host, $username, $password, $path, $port = self::DEFAULT_PORT)
+    public static function getInstance($host, $username, $password, $path, $port = self::DEFAULT_PORT, $checkConnection = true)
     {
-        return new SFTP(new \Cubist\Net\Server\SFTP($host, $username, $password, $path, $port));
+
+        return new SFTP(new \Cubist\Net\Server\SFTP($host, $username, $password, $path, $port), $checkConnection);
     }
 
     protected function synchronizeFiles($source, $dest, $mirror = false, $dryrun = false)
@@ -33,11 +33,15 @@ class SFTP extends Driver
         $rclone->setMirror($mirror);
         $rclone->setDryRun($dryrun);
         $rclone->execute();
+        $rclone->debug();
         return $rclone;
     }
 
     public function checkConnexion($data = [])
     {
+        if (!$this->checkConnection) {
+            return true;
+        }
         $connection = null;
 
         $data = [
@@ -90,4 +94,4 @@ class SFTP extends Driver
         $filepath = explode('/', $file);
         return end($filepath);
     }
-}
\ No newline at end of file
+}