]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6775 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Mar 2024 08:22:38 +0000 (09:22 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 12 Mar 2024 08:22:38 +0000 (09:22 +0100)
app/Console/Commands/WebflowMirrorSite.php [deleted file]
app/Jobs/WebflowPublish.php
app/Models/ToolWebflow.php

diff --git a/app/Console/Commands/WebflowMirrorSite.php b/app/Console/Commands/WebflowMirrorSite.php
deleted file mode 100644 (file)
index ee8fd28..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-
-namespace App\Console\Commands;
-
-use App\Console\Commands\Base\ToolboxCommand;
-use App\Jobs\WebflowMirror;
-use App\Models\ToolWebflow;
-
-class WebflowMirrorSite extends ToolboxCommand
-{
-    protected $signature = 'webflow:mirror {id} {--force} {--slow}';
-
-    public function handle()
-    {
-        $job=new WebflowMirror($this->argument('id'),$this->option('force'),$this->option('slow'));
-        $job->handle();
-    }
-}
index 16e51156af3f56cfb2ae538b8c7ed8a4af420e3b..c9f1d7174b03ac0e985c965cdf987242484f7b1c 100644 (file)
@@ -40,7 +40,7 @@ class WebflowPublish extends Base
             $text = __('Le site vient d\'être républié suite à une déclenchement manuel');
         }
 
-        StaticSiteUploader::rsync(protected_path('webflow/' . $this->id), $wf->upload);
+
         $actions = [];
         foreach ($wf->getLocales() as $locale) {
             $actions[__('Visiter [:locale]', ['locale' => $locale['locale']])] = 'https://' . $locale['url'];
index 2b66c8c4ac75d01e35b4b5c4f545e29e278dceb3..d6a5c509aeceea57b92074140a466b792e2f60ed 100644 (file)
@@ -14,6 +14,7 @@ use Cubist\Backpack\Magic\Fields\Textarea;
 use Cubist\Backpack\Magic\Fields\URL;
 use Cubist\Util\CommandLine;
 use Cubist\Util\Files\Files;
+use Cubist\Util\Files\VirtualDirectory;
 use Illuminate\Support\Facades\Cache;
 
 // __('!! Outils')
@@ -73,7 +74,7 @@ class ToolWebflow extends ToolboxModel
      */
     public function mirror($slow = true, $force = false)
     {
-        $path = Files::mkdir(protected_path('webflow/' . $this->id));
+        $path = Files::mkdir(protected_path('webflow/mirrors/' . $this->id));
         if ($force) {
             $path = Files::emptyDir($path);
         }
@@ -111,9 +112,20 @@ class ToolWebflow extends ToolboxModel
 
     }
 
-    protected function _parseHtml()
+    protected function compile()
     {
+        foreach ($this->getLocales() as $locale) {
+            $this->compileLocale($locale['locale']);
+        }
+        StaticSiteUploader::rsync(protected_path('webflow/final/' . $this->id), $this->upload);
+    }
 
+    protected function compileLocale($locale)
+    {
+        $mirror = Files::mkdir(protected_path('webflow/mirrors/' . $this->id));
+        $path = Files::mkdir(protected_path('webflow/final/' . $this->id . '/' . $locale));
+        $rsync = new CommandLine\Rsync($mirror, $path, true);
+        $rsync->execute();
     }
 
     public function onRetrieved(): bool
@@ -123,7 +135,6 @@ class ToolWebflow extends ToolboxModel
             $locales = json_decode($locales, true);
         }
         Cache::put('webflow_' . $this->id . '_locales', $locales);
-        dddd($this->getLocales());
         return parent::onRetrieved();
     }