Skip to content

Commit

Permalink
Merge branch 'feature/v3-update-command' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
itinerare committed Dec 17, 2023
2 parents 342ddf1 + 8fdee82 commit bb556e6
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 11 deletions.
16 changes: 7 additions & 9 deletions app/Console/Commands/CheckReleasedItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,16 @@ class CheckReleasedItems extends Command {
* @return int
*/
public function handle() {
$this->info('*************************');
$this->info('* UPDATE RELEASED ITEMS *');
$this->info('*************************'."\n");

$this->line('Searching for released items...');

$userItems = UserItem::pluck('item_id')->unique()->toArray();
$releasedItems = Item::where('is_released', 0)->whereIn('id', $userItems);

$this->info('Updating items...');
$releasedItems->update(['is_released' => 1]);
$this->info('Updated items.');
if ($releasedItems->count()) {
$this->line('Updating items...');
$releasedItems->update(['is_released' => 1]);
$this->info('Updated items.');
} else {
$this->line('No items need updating!');
}

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion app/Console/Commands/FillExistingFullsizeExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle() {
$image->update(['fullsize_extension' => $image->extension]);
}

$this->line('Done!');
$this->info('Done!');
} else {
$this->line('No images need processing!');
}
Expand Down
3 changes: 2 additions & 1 deletion app/Console/Commands/UpdateCommentTypes.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ public function handle() {
if ($comments->count()) {
$this->line('Updating comment types...');
$comments->update(['type' => 'Staff-User']);
$this->info('Comment types updated!');
} else {
$this->info('No comments to update!');
$this->line('No comments need updating!');
}

return 0;
Expand Down
69 changes: 69 additions & 0 deletions app/Console/Commands/UpdateLorekeeperV3.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class UpdateLorekeeperV3 extends Command {
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'update-lorekeeper-v3';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Runs commands to update Lorekeeper to version 3.0 from version 2.';

/**
* Create a new command instance.
*/
public function __construct() {
parent::__construct();
}

/**
* Execute the console command.
*
* @return int
*/
public function handle() {
$this->info('**************************');
$this->info('* UPDATE LOREKEEPER (V3) *');
$this->info('**************************'."\n");

// Check if the user has run composer
$this->info('This command should be run after installing packages using composer.');
if ($this->confirm('Have you run the composer install command or equivalent?')) {
// Migrate
$this->line('Running migrations...');
$this->call('migrate');

// Clear caches
$this->line("\n".'Clearing caches...');
$this->call('optimize');
$this->call('view:clear');
$this->call('route:clear');

// Run miscellaneous commands
$this->line("\n".'Updating site pages and settings...');
$this->call('add-site-settings');
$this->call('add-text-pages');

$this->line("\n".'Updating character images...');
$this->call('app:fill-character-fullsize-extensions');

$this->line("\n".'Updating released items...');
$this->call('update-released-items');

$this->line("\n".'Updating comments...');
$this->call('update-comment-types');
} else {
$this->line('Aborting! Please run composer update and then run this command again.');
}
}
}

0 comments on commit bb556e6

Please sign in to comment.