From: Vincent Vanwaelscappel Date: Tue, 12 Mar 2024 08:22:38 +0000 (+0100) Subject: wip #6775 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=677c786bad39022f2d4d3ab0aa8ae280c9dc5492;p=fluidbook-toolbox.git wip #6775 @0.5 --- diff --git a/app/Console/Commands/WebflowMirrorSite.php b/app/Console/Commands/WebflowMirrorSite.php deleted file mode 100644 index ee8fd2816..000000000 --- a/app/Console/Commands/WebflowMirrorSite.php +++ /dev/null @@ -1,18 +0,0 @@ -argument('id'),$this->option('force'),$this->option('slow')); - $job->handle(); - } -} diff --git a/app/Jobs/WebflowPublish.php b/app/Jobs/WebflowPublish.php index 16e51156a..c9f1d7174 100644 --- a/app/Jobs/WebflowPublish.php +++ b/app/Jobs/WebflowPublish.php @@ -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']; diff --git a/app/Models/ToolWebflow.php b/app/Models/ToolWebflow.php index 2b66c8c4a..d6a5c509a 100644 --- a/app/Models/ToolWebflow.php +++ b/app/Models/ToolWebflow.php @@ -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(); }