+++ /dev/null
-<?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();
- }
-}
$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'];
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')
*/
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);
}
}
- 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
$locales = json_decode($locales, true);
}
Cache::put('webflow_' . $this->id . '_locales', $locales);
- dddd($this->getLocales());
return parent::onRetrieved();
}