42 lines
918 B
PHP
42 lines
918 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Console\Commands\Bundle;
|
||
|
|
||
|
use App\Classes\Bundle;
|
||
|
use Illuminate\Console\Command;
|
||
|
use Illuminate\Support\Facades\Storage;
|
||
|
|
||
|
class Repair extends Command
|
||
|
{
|
||
|
/**
|
||
|
* The name and signature of the console command.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $signature = 'bundle:repair { path? : Specific bundle to repair }';
|
||
|
|
||
|
/**
|
||
|
* The console command description.
|
||
|
*
|
||
|
* @var string
|
||
|
*/
|
||
|
protected $description = 'Repair articles';
|
||
|
|
||
|
/**
|
||
|
* Execute the console command.
|
||
|
*/
|
||
|
public function handle()
|
||
|
{
|
||
|
$path = $this->argument('path') ?? '/';
|
||
|
$bundles = Bundle::findBundles(Storage::disk(env('CONTENT_DISK')), $path, true);
|
||
|
|
||
|
foreach ($bundles as $bundle) {
|
||
|
$this->output->write(sprintf('Repairing %s... ', $bundle->getPath()));
|
||
|
|
||
|
$bundle->repair();
|
||
|
|
||
|
$this->info('OK');
|
||
|
}
|
||
|
}
|
||
|
}
|