]> _ Git - cubist_net.git/commitdiff
wip #5700 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 13 Feb 2023 17:05:40 +0000 (18:05 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 13 Feb 2023 17:05:40 +0000 (18:05 +0100)
src/Transfer/FTP.php
src/Transfer/IServer.php
src/Transfer/Local.php

index 8de4ec92a7c3c2b18ec216eff77b7d3ff8739a9a..0c378b5ba90a3f72db03a092ed646c8975ed7b8b 100644 (file)
@@ -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;
index b3abfedea46bf77c71fb4327439fa3e4f4ebe8c0..4738209ba5a7ddfe9d144c9d45a52a50221abd82 100644 (file)
@@ -43,5 +43,6 @@ interface IServer {
         */
        public function getSettings();
 
+       public function makeURL($path);
 
 }
\ No newline at end of file
index 557b75be92153d42b55edc07ae0fd1cbe9f76a75..56092e3a051a6640a533f8b8b66a0e747c744c9c 100644 (file)
@@ -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();