Added the ability to completely wipe links data out of bundles
This commit is contained in:
parent
6161d8c630
commit
454ce181b3
|
@ -114,6 +114,14 @@ public function setMany(array $array, bool $replace = false)
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Forget any metadata in this file.
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->content = [];
|
||||
}
|
||||
|
||||
public function merge(array $array)
|
||||
{
|
||||
$content = collect($this->content)->dot();
|
||||
|
|
|
@ -13,7 +13,10 @@ class DeadLinks extends Command
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'bundle:dead-links { --r|recursive : Also check sub-bundles } { path? : Specific bundle for which to find dead links }';
|
||||
protected $signature = 'bundle:dead-links
|
||||
{ --c|clear : Clear current links.json file }
|
||||
{ --r|recursive : Also check sub-bundles }
|
||||
{ path? : Specific bundle for which to find dead links }';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
|
@ -39,6 +42,13 @@ public function handle()
|
|||
foreach ($bundles as $bundle) {
|
||||
$bundle->load();
|
||||
|
||||
if ($this->option('clear')) {
|
||||
$bundle->metadata('links')->clear();
|
||||
$bundle->metadata('links')->save();
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$deadLinks = [];
|
||||
|
||||
foreach ($bundle->metadata('links')->all() as $url => $data) {
|
||||
|
@ -58,5 +68,11 @@ public function handle()
|
|||
$this->newLine();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->option('clear')) {
|
||||
$this->call('cache:clear');
|
||||
$this->comment('links.json file(s) have been removed.');
|
||||
$this->line('Remember to re-render bundles to check for dead links.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user