2024-04-20 23:27:47 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Console\Commands\Bundle;
|
|
|
|
|
|
|
|
use App\Classes\Bundle;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
|
|
|
|
class Upgrade extends Command
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name and signature of the console command.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $signature = 'bundle:upgrade { path? : Specific bundle to upgrade }';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The console command description.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $description = 'Upgrade bundles from previous CMS version';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Execute the console command.
|
|
|
|
*/
|
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
$disk = Storage::disk(env('CONTENT_DISK'));
|
|
|
|
$path = $this->argument('path') ?? '/';
|
|
|
|
$bundles = Bundle::findBundles($disk, $path, true);
|
|
|
|
|
|
|
|
foreach ($bundles as $bundle) {
|
|
|
|
$this->output->write(sprintf('Upgrading %s... ', $bundle->getPath()));
|
|
|
|
|
2024-05-09 21:51:12 +02:00
|
|
|
$bundle->metadata()->remove('lastModified');
|
|
|
|
$bundle->metadata()->remove('lastRendered');
|
2024-04-23 11:58:51 +02:00
|
|
|
|
2024-04-26 12:50:38 +02:00
|
|
|
$bundle->save();
|
2024-04-23 11:58:51 +02:00
|
|
|
|
2024-04-20 23:27:47 +02:00
|
|
|
$this->info('OK');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|