]> _ Git - cubist_util.git/commitdiff
#7567 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Jun 2025 14:50:04 +0000 (16:50 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 12 Jun 2025 14:50:04 +0000 (16:50 +0200)
src/CommandLine/LocalToGCSRclone.php

index d4521b3fdf348b14c87e7e61cbde172088db0a28..018c12b4ccd3721e2bf8051419d328361e26e9a0 100644 (file)
@@ -3,6 +3,7 @@
 namespace Cubist\Util\CommandLine;
 
 use Cubist\Net\Transfer\IServer;
+use Cubist\Util\CommandLine;
 use Cubist\Util\Files\Files;
 
 class LocalToGCSRclone extends CloneProgram
@@ -31,6 +32,7 @@ class LocalToGCSRclone extends CloneProgram
         $this->setManualArg($dest);
     }
 
+
     public function setServer(IServer $server)
     {
         parent::setServer($server);
@@ -75,4 +77,20 @@ class LocalToGCSRclone extends CloneProgram
     {
         return true;
     }
+
+    public function execute($fonction = 'shell_exec')
+    {
+        parent::execute($fonction);
+
+        $ls = new CommandLine('rclone');
+        $ls->setArg(null, 'lsl');
+        $tmp = Files::tempnam();
+        file_put_contents($tmp, $this->getGCSServiceAccountKey());
+        $ls->setArg('gcs-service-account-file', $tmp);
+        $ls->setArg('gcs-bucket-policy-only');
+        $dest = ':gcs:' . $this->getBucket() . '/' . rtrim($this->getDest(), '/') . '/';
+        $ls->setManualArg($dest);
+        $ls->execute();
+        $ls->debug();
+    }
 }
\ No newline at end of file