From: Vincent Vanwaelscappel Date: Thu, 18 Jan 2024 11:23:00 +0000 (+0100) Subject: wip #6639 @0.25 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=5adcd0817db42265bfc5be3252c70bd1655c3f3b;p=cubist_util.git wip #6639 @0.25 --- diff --git a/src/CommandLine/Rsync.php b/src/CommandLine/Rsync.php index 841e374..23a69b1 100644 --- a/src/CommandLine/Rsync.php +++ b/src/CommandLine/Rsync.php @@ -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); }