mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
Rename and clean up commands.
This commit is contained in:
@@ -32,9 +32,6 @@ use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
/**
|
||||
* Class TransactionIdentifier
|
||||
*/
|
||||
class AddsTransactionIdentifiers extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -14,7 +14,7 @@ class UpgradeSkeleton extends Command
|
||||
|
||||
protected $description = 'SOME DESCRIPTION';
|
||||
|
||||
protected $signature = 'firefly-iii:UPGRSKELETON {--F|force : Force the execution of this command.}';
|
||||
protected $signature = 'upgrade:UPGRSKELETON {--F|force : Force the execution of this command.}';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
|
@@ -36,9 +36,6 @@ use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class AccountCurrencies
|
||||
*/
|
||||
class UpgradesAccountCurrencies extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -30,9 +30,6 @@ use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Note;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class MigrateAttachments
|
||||
*/
|
||||
class UpgradesAttachments extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -32,9 +32,6 @@ use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Class UpgradesCurrencyPreferences
|
||||
*/
|
||||
class UpgradesCurrencyPreferences extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -63,6 +63,10 @@ class UpgradesDatabase extends Command
|
||||
'upgrade:550-budget-limit-periods',
|
||||
'upgrade:600-rule-actions',
|
||||
'upgrade:610-account-balance',
|
||||
'upgrade:610-currency-preferences',
|
||||
'upgrade:610-currency-preferences',
|
||||
'upgrade:620-piggy-banks',
|
||||
'upgrade:620-native-amounts',
|
||||
'firefly-iii:correct-database',
|
||||
];
|
||||
$args = [];
|
||||
|
79
app/Console/Commands/Upgrade/UpgradesNativeAmounts.php
Normal file
79
app/Console/Commands/Upgrade/UpgradesNativeAmounts.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
/*
|
||||
* UpgradesNativeAmounts.php
|
||||
* Copyright (c) 2024 james@firefly-iii.org.
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see https://www.gnu.org/licenses/.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Console\Commands\Upgrade;
|
||||
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
class UpgradesNativeAmounts extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
public const string CONFIG_NAME = '620_native_amounts';
|
||||
|
||||
protected $description = 'Runs the native amounts calculations.';
|
||||
|
||||
protected $signature = 'upgrade:620-native-amounts {--F|force : Force the execution of this command.}';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
if ($this->isExecuted() && true !== $this->option('force')) {
|
||||
$this->friendlyInfo('This command has already been executed.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Artisan::call('correction:recalculate-native-amounts');
|
||||
|
||||
$this->markAsExecuted();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
private function isExecuted(): bool
|
||||
{
|
||||
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false);
|
||||
if (null !== $configVar) {
|
||||
return (bool)$configVar->data;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function markAsExecuted(): void
|
||||
{
|
||||
app('fireflyconfig')->set(self::CONFIG_NAME, true);
|
||||
}
|
||||
}
|
@@ -30,9 +30,6 @@ use FireflyIII\Models\RecurrenceMeta;
|
||||
use FireflyIII\Models\RecurrenceTransactionMeta;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class MigrateRecurrenceMeta
|
||||
*/
|
||||
class UpgradesRecurrenceMetaData extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -27,9 +27,6 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class MigrateRecurrenceType
|
||||
*/
|
||||
class UpgradesRecurrenceType extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -29,9 +29,6 @@ use FireflyIII\Models\Location;
|
||||
use FireflyIII\Models\Tag;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class MigrateTagLocations
|
||||
*/
|
||||
class UpgradesTagLocations extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
@@ -34,10 +34,7 @@ use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
/**
|
||||
* Class UpgradeTransferCurrencies
|
||||
*/
|
||||
class UpgradeTransferCurrencies extends Command
|
||||
class UpgradesTransferCurrencies extends Command
|
||||
{
|
||||
use ShowsFriendlyMessages;
|
||||
|
Reference in New Issue
Block a user