]> _ Git - cubist_net.git/commitdiff
wip #7175
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Nov 2024 18:53:41 +0000 (19:53 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 5 Nov 2024 18:53:41 +0000 (19:53 +0100)
src/Transfer/S3.php

index 45739284513f869fbf58cb13ecf98cf69cbcc8da..ed76ea700cf6bba001de602115f6abef06b90cb5 100644 (file)
@@ -3,6 +3,7 @@
 namespace Cubist\Net\Transfer;
 
 use Aws\S3\S3Client;
+use Cubist\Util\CommandLine\LocalToS3Rclone;
 use Cubist\Util\CommandLine\Rclone;
 
 class S3 extends Driver
@@ -14,7 +15,7 @@ class S3 extends Driver
     /**
      * @return S3Client
      */
-    protected function createClient($data)
+    protected function createClient(&$data)
     {
         return new S3Client($this->_getClientConfig($data));
     }
@@ -22,11 +23,11 @@ class S3 extends Driver
 
     public function checkConnexion($data = [])
     {
+        $client = $this->createClient($data);
+
         $test = 'test' . time() . '-' . rand(1, 1000000);
         $testFile = trim($data['base_path'], '/') . '/' . $test . '.txt';
 
-        $client = $this->createClient($data);
-
         $oc = ['Bucket' => $data['bucket'], 'Key' => $testFile];
 
         try {
@@ -74,7 +75,8 @@ class S3 extends Driver
     protected function synchronizeFiles($source, $dest, $mirror = false, $dryrun = false)
     {
 
-        $rclone = new Rclone();
+        $rclone = new LocalToS3Rclone();
+        $rclone->setServer($this->getServer());
         $rclone->setArg();
         $rclone->setSrc($source);
         $rclone->setDest(rtrim($this->getServer()->getBasePath(), '/') . '/' . trim($dest, '/') . '/');