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');
$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',
];
$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();
}
public function onRetrieved(): bool
{
Cache::put('webflow_' . $this->id . '_locales', $this->locales);
+ $this->mirror();
return parent::onRetrieved();
}