From e213e6046d77cc20ee479b8c14f83421d24ee2e1 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 13 Feb 2023 18:05:40 +0100 Subject: [PATCH] wip #5700 @1.5 --- src/Transfer/FTP.php | 2 +- src/Transfer/IServer.php | 1 + src/Transfer/Local.php | 22 ++++++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Transfer/FTP.php b/src/Transfer/FTP.php index 8de4ec9..0c378b5 100644 --- a/src/Transfer/FTP.php +++ b/src/Transfer/FTP.php @@ -8,10 +8,10 @@ use Cubist\Util\CommandLine\Rclone; class FTP extends Driver { public function copy($source, $dest, $mirror = false, $dryrun = false) { $lftp = new LFTP(); + $lftp->setServer($this->getServer()); $lftp->setSrc($source); $lftp->setDest($dest); $lftp->setMirror($mirror); - $lftp->setServer($this->getServer()); $lftp->setDryRun($dryrun); $lftp->execute(); return $lftp; diff --git a/src/Transfer/IServer.php b/src/Transfer/IServer.php index b3abfed..4738209 100644 --- a/src/Transfer/IServer.php +++ b/src/Transfer/IServer.php @@ -43,5 +43,6 @@ interface IServer { */ public function getSettings(); + public function makeURL($path); } \ No newline at end of file diff --git a/src/Transfer/Local.php b/src/Transfer/Local.php index 557b75b..56092e3 100644 --- a/src/Transfer/Local.php +++ b/src/Transfer/Local.php @@ -5,27 +5,27 @@ namespace Cubist\Net\Transfer; use Cubist\Util\CommandLine\Rsync; class Local extends Driver { - protected $_basePath = ''; + protected $_rootPath = ''; - public function __construct(IServer $server, $basePath = null) { + public function __construct(IServer $server, $rootPath = null) { parent::__construct($server); - if (null !== $basePath) { - $this->setBasePath($basePath); + if (null !== $rootPath) { + $this->setRootPath($rootPath); } } /** - * @param string $basePath + * @param string $rootPath */ - public function setBasePath($basePath) { - $this->_basePath = $basePath; + public function setRootPath($rootPath) { + $this->_rootPath = $rootPath; } /** * @return string */ - public function getBasePath() { - return $this->_basePath; + public function getRootPath() { + return $this->_rootPath; } /** @@ -33,11 +33,13 @@ class Local extends Driver { * @return string */ protected function _destPath($path) { - return rtrim($this->getBasePath(), '/') . '/' . self::_cleanInstallDir($path) . '/'; + return rtrim($this->getRootPath(), '/') . '/' . self::_cleanInstallDir($path) . '/'; } public function copy($source, $dest, $mirror = false, $dryrun = false) { $rsync = new Rsync($source, $dest); + $rsync->setServer($this->getServer()); + $rsync->setBasePath(rtrim($this->getRootPath(), '/') . '/' . ltrim($this->getServer()->getBasePath(), '/')); $rsync->setMirror($mirror); $rsync->setDryRun($dryrun); $rsync->execute(); -- 2.39.5