]> _ Git - cubist_util.git/commitdiff
wip #6639 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Jan 2024 11:23:00 +0000 (12:23 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 18 Jan 2024 11:23:00 +0000 (12:23 +0100)
src/CommandLine/Rsync.php

index 841e3748ae27724a424186bd39b268fa74e4ef98..23a69b194770cde9792b9fd69095d7d17a32d416 100644 (file)
@@ -22,6 +22,10 @@ class Rsync extends CloneProgram
     protected $_followSymlinks = false;
     protected $_copySymlinksAsSymlinks = false;
 
+    protected $_preserveTimes = true;
+    protected $_preservePermissions = true;
+    protected $_preserveOwner = false;
+
 
     public function getSshKey()
     {
@@ -119,6 +123,54 @@ class Rsync extends CloneProgram
         return $path;
     }
 
+    /**
+     * @param bool $preserveOwner
+     */
+    public function setPreserveOwner(bool $preserveOwner): void
+    {
+        $this->_preserveOwner = $preserveOwner;
+    }
+
+    /**
+     * @param bool $preservePermissions
+     */
+    public function setPreservePermissions(bool $preservePermissions): void
+    {
+        $this->_preservePermissions = $preservePermissions;
+    }
+
+    /**
+     * @param bool $preserveTimes
+     */
+    public function setPreserveTimes(bool $preserveTimes): void
+    {
+        $this->_preserveTimes = $preserveTimes;
+    }
+
+    /**
+     * @return bool
+     */
+    public function getPreserveOwner(): bool
+    {
+        return $this->_preserveOwner;
+    }
+
+    /**
+     * @return bool
+     */
+    public function getPreservePermissions(): bool
+    {
+        return $this->_preservePermissions;
+    }
+
+    /**
+     * @return bool
+     */
+    public function getPreserveTimes(): bool
+    {
+        return $this->_preserveTimes;
+    }
+
     protected function _preExecute()
     {
         $dest = $this->getFinalDest();
@@ -156,6 +208,16 @@ class Rsync extends CloneProgram
         if ($this->getCopySymlinksAsSymlinks()) {
             $this->setArg('l');
         }
+        if($this->getPreserveTimes()){
+            $this->setArg('t');
+        }
+        if($this->getPreserveOwner()){
+            $this->setArg('o');
+            $this->setArg('g');
+        }
+        if($this->getPreservePermissions()){
+            $this->setArg('p');
+        }
         foreach ($this->_excludes as $e) {
             $this->setArg('exclude', $e);
         }