namespace Cubist\Util\CommandLine;
use Cubist\Net\Transfer\IServer;
+use Cubist\Util\CommandLine;
use Cubist\Util\Files\Files;
class LocalToGCSRclone extends CloneProgram
$this->setManualArg($dest);
}
+
public function setServer(IServer $server)
{
parent::setServer($server);
{
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