]> _ Git - cubist_cms-back.git/commitdiff
wip #5700 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Feb 2023 15:52:37 +0000 (16:52 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 6 Feb 2023 15:52:37 +0000 (16:52 +0100)
src/app/Magic/Models/ExternalServer.php

index d123bfec3b22d5c1be175cdfa04d43e005e3b7d0..7ef094dd3300594c1c89b2dcf98d0d504b1fdc84 100644 (file)
@@ -25,7 +25,6 @@ class ExternalServer extends CubistMagicAbstractModel implements IServer
     {
         parent::setFields();
 
-
         $this->addField('name', Text::class, __('Nom'), ['column' => true]);
         $this->addField('protocol', SelectFromArray::class, __('Protocole'), ['options' => $this->getProtocols(), 'default' => 'FTP', 'column' => true, 'allows_null' => false]);
         $this->addField('ftp_mode', SelectFromArray::class, __('Mode de transfert'), ['options' => ['0' => __('Mode passif'), '1' => __('Mode actif')], 'default' => '1', 'when' => ['protocol' => $this->getPasswordProtocols()], 'allows_null' => false,]);
@@ -140,4 +139,13 @@ class ExternalServer extends CubistMagicAbstractModel implements IServer
     {
         return ['ftp_port' => $this->ftp_port];
     }
+
+    public function makeURL($path)
+    {
+        $base = $this->getBaseURL();
+        if (!$base) {
+            return null;
+        }
+        return rtrim($base, '/') . '/' . trim($path, '/');
+    }
 }