]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6775 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Mar 2024 17:22:29 +0000 (18:22 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 11 Mar 2024 17:22:29 +0000 (18:22 +0100)
app/Models/ToolWebflow.php

index d3c48c0129573a82dee8e1c015310f9e37d9165a..02f4e90b011e18057cecf2338e22a538f2ac9d84 100644 (file)
@@ -41,9 +41,12 @@ class ToolWebflow extends ToolboxModel
         return Cache::get('webflow_' . $this->id . '_locales', []);
     }
 
-    public function mirror($slow = true)
+    public function mirror($slow = true, $reset = false)
     {
         $path = Files::mkdir(protected_path('webflow/' . $this->id));
+        if ($reset) {
+            $path = Files::emptyDir($path);
+        }
         $wget = new CommandLine('wget');
         $wget->setArg('mirror');
         $wget->setArg('convert-links');
@@ -53,7 +56,7 @@ class ToolWebflow extends ToolboxModel
         $wget->setArg("directory-prefix", $path);
         $wget->setArg("span-hosts");
         if ($slow) {
-            $wget->setArg("w", 10);
+            $wget->setArg("w", $reset ? 2 : 10);
             $wget->setArg("random-wait");
         }
         $domains = [$this->webflow . '.webflow.io',
@@ -65,8 +68,12 @@ class ToolWebflow extends ToolboxModel
         ];
         $wget->setArg("domains", implode(',', $domains));
         $wget->setArg("compression", 'auto');
+        if (!$reset) {
+            $wget->setArg('N');
+        }
         $wget->setArg(null, 'https://' . $this->webflow . '.webflow.io');
         $wget->execute();
+        $wget->dd();
 
     }
 
@@ -78,6 +85,7 @@ class ToolWebflow extends ToolboxModel
     public function onRetrieved(): bool
     {
         Cache::put('webflow_' . $this->id . '_locales', $this->locales);
+        $this->mirror();
         return parent::onRetrieved();
     }