1
0
cms11/app/Console/Commands/Bundle/Upgrade.php

52 lines
1.3 KiB
PHP
Raw Normal View History

<?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-05-12 00:07:04 +02:00
$bundle->metadata('links')->clear();
$bundle->metadata('links')->save();
2024-05-12 14:47:44 +02:00
$bundle->metadata('rebrickable')->clear();
$bundle->metadata('rebrickable')->save();
2024-04-26 12:50:38 +02:00
$bundle->save();
2024-04-23 11:58:51 +02:00
$this->info('OK');
}
}
}