From 8ca0e77316c93612593605ede9b457208fe1ae1f Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 30 Jan 2023 11:26:43 +0100 Subject: [PATCH] wip #5700 @0.5 --- composer.lock | 10 +++--- src/CommandLine/CloneProgram.php | 42 ++++++++++++++++++++++++ src/CommandLine/CloneUserpassProgram.php | 2 ++ 3 files changed, 49 insertions(+), 5 deletions(-) diff --git a/composer.lock b/composer.lock index ed7d9ac..d81c605 100644 --- a/composer.lock +++ b/composer.lock @@ -68,13 +68,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/cubist_net.git", - "reference": "afc022a3a2f8934c321d8f1ab3b36a0d716254cd" + "reference": "c7e86c950bac79f1f8f05627c120cdabd77c572a" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-f6e9d7.tar", - "reference": "afc022a3a2f8934c321d8f1ab3b36a0d716254cd", - "shasum": "bd10e7999bbe55165eab57cf3f08af2c972a8338" + "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-b52505.tar", + "reference": "c7e86c950bac79f1f8f05627c120cdabd77c572a", + "shasum": "dd64e294afe5c54b0e9fbc5fde179918f756e64d" }, "require": { "cubist/util": "dev-master", @@ -98,7 +98,7 @@ } ], "description": "net cubist composer package", - "time": "2023-01-27T07:49:39+00:00" + "time": "2023-01-27T14:43:25+00:00" }, { "name": "dflydev/dot-access-data", diff --git a/src/CommandLine/CloneProgram.php b/src/CommandLine/CloneProgram.php index 60cb1ab..1791114 100644 --- a/src/CommandLine/CloneProgram.php +++ b/src/CommandLine/CloneProgram.php @@ -2,6 +2,7 @@ namespace Cubist\Util\CommandLine; +use Cubist\Net\Transfer\IServer; use Cubist\Util\CommandLine; class CloneProgram extends CommandLine @@ -30,6 +31,12 @@ class CloneProgram extends CommandLine */ protected $_prog; + + /** + * @var string + */ + protected $_basePath = ''; + /** * @var array */ @@ -100,8 +107,43 @@ class CloneProgram extends CommandLine return $this; } + /** + * @return string + */ + public function getBasePath(): string + { + return $this->_basePath; + } + + /** + * @param string $basePath + */ + public function setBasePath(string $basePath): void + { + $this->_basePath = $basePath; + } + + public function getFinalDest() + { + $base = rtrim($this->getBasePath(), '/'); + $res = ''; + if ($base) { + $res .= $base . '/'; + $res .= ltrim($this->getDest() . '/'); + } else { + $res .= $this->getDest(); + } + return $res; + } + public function setCloneArg($name, $value = null) { $this->_cloneArgs[] = [$name, $value]; } + + + public function setServer(IServer $server) + { + $this->setBasePath($server->getBasePath()); + } } \ No newline at end of file diff --git a/src/CommandLine/CloneUserpassProgram.php b/src/CommandLine/CloneUserpassProgram.php index 167b10b..a9fffb2 100644 --- a/src/CommandLine/CloneUserpassProgram.php +++ b/src/CommandLine/CloneUserpassProgram.php @@ -113,8 +113,10 @@ class CloneUserpassProgram extends CloneProgram $this->_host = $host; } + public function setServer(IServer $server) { + parent::setServer($server); $this->setProtocol($server->getProtocol()); $this->setHost($server->getHost()); $this->setPort($server->getPort()); -- 2.39.5