diff --git a/app/Console/Commands/Correction/CorrectAmounts.php b/app/Console/Commands/Correction/CorrectAmounts.php index 462c9847a8..c2fda9333f 100644 --- a/app/Console/Commands/Correction/CorrectAmounts.php +++ b/app/Console/Commands/Correction/CorrectAmounts.php @@ -39,22 +39,10 @@ use Illuminate\Console\Command; */ class CorrectAmounts extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'This command makes sure positive and negative amounts are recorded correctly.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-amount-pos-neg'; + protected $signature = 'firefly-iii:fix-amount-pos-neg'; /** - * Execute the console command. - * * @return int */ public function handle(): int diff --git a/app/Console/Commands/Correction/CorrectDatabase.php b/app/Console/Commands/Correction/CorrectDatabase.php index 633fcd6df9..aed810e830 100644 --- a/app/Console/Commands/Correction/CorrectDatabase.php +++ b/app/Console/Commands/Correction/CorrectDatabase.php @@ -34,25 +34,14 @@ use Schema; */ class CorrectDatabase extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Will correct the integrity of your database, if necessary.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:correct-database'; + protected $signature = 'firefly-iii:correct-database'; /** * Execute the console command. */ public function handle(): int { - $this->line('Handle Firefly III database correction commands.'); // if table does not exist, return false if (!Schema::hasTable('users')) { $this->error('No "users"-table, will not continue.'); diff --git a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php index f94ebdaefb..14d6b299a6 100644 --- a/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php +++ b/app/Console/Commands/Correction/CorrectOpeningBalanceCurrencies.php @@ -24,7 +24,6 @@ declare(strict_types=1); namespace FireflyIII\Console\Commands\Correction; -use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\Account; use FireflyIII\Models\AccountType; use FireflyIII\Models\Transaction; @@ -33,26 +32,15 @@ use FireflyIII\Models\TransactionJournal; use FireflyIII\Models\TransactionType; use FireflyIII\Repositories\Account\AccountRepositoryInterface; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Log; -use JsonException; +use Illuminate\Support\Collection; /** * Class CorrectOpeningBalanceCurrencies */ class CorrectOpeningBalanceCurrencies extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Will make sure that opening balance transaction currencies match the account they\'re for.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-ob-currencies'; + protected $signature = 'firefly-iii:fix-ob-currencies'; /** * Execute the console command. @@ -61,32 +49,22 @@ class CorrectOpeningBalanceCurrencies extends Command */ public function handle(): int { - Log::debug(sprintf('Now in %s', __METHOD__)); - // get all OB journals: - $set = TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') - ->whereNull('transaction_journals.deleted_at') - ->where('transaction_types.type', TransactionType::OPENING_BALANCE)->get(['transaction_journals.*']); - - $this->line(sprintf('Going to verify %d opening balance transactions.', $set->count())); - $count = 0; + $journals = $this->getJournals(); + $count = 0; /** @var TransactionJournal $journal */ - foreach ($set as $journal) { + foreach ($journals as $journal) { $count += $this->correctJournal($journal); } if ($count > 0) { $message = sprintf('Corrected %d opening balance transaction(s).', $count); - Log::debug($message); $this->line($message); } if (0 === $count) { - $message = 'There was nothing to fix in the opening balance transactions.'; - Log::debug($message); + $message = 'Correct: There was nothing to fix in the opening balance transactions.'; $this->info($message); } - Log::debug(sprintf('Done with %s', __METHOD__)); - return 0; } @@ -94,24 +72,21 @@ class CorrectOpeningBalanceCurrencies extends Command * @param TransactionJournal $journal * * @return int - * @throws FireflyException - * @throws JsonException */ private function correctJournal(TransactionJournal $journal): int { // get the asset account for this opening balance: $account = $this->getAccount($journal); if (null === $account) { - $message = sprintf('Transaction journal #%d has no valid account. Cant fix this line.', $journal->id); + $message = sprintf('Transaction journal #%d has no valid account. Can\'t fix this line.', $journal->id); app('log')->warning($message); $this->warn($message); return 0; } - $currency = $this->getCurrency($account); // update journal and all transactions: - return $this->setCurrency($journal, $currency); + return $this->setCorrectCurrency($account, $journal); } /** @@ -138,8 +113,6 @@ class CorrectOpeningBalanceCurrencies extends Command * @param Account $account * * @return TransactionCurrency - * @throws JsonException - * @throws FireflyException */ private function getCurrency(Account $account): TransactionCurrency { @@ -151,14 +124,25 @@ class CorrectOpeningBalanceCurrencies extends Command } /** + * @return Collection + */ + private function getJournals(): Collection + { + /** @var Collection */ + return TransactionJournal::leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') + ->whereNull('transaction_journals.deleted_at') + ->where('transaction_types.type', TransactionType::OPENING_BALANCE)->get(['transaction_journals.*']); + } + + /** + * @param Account $account * @param TransactionJournal $journal - * @param TransactionCurrency $currency - * * @return int */ - private function setCurrency(TransactionJournal $journal, TransactionCurrency $currency): int + private function setCorrectCurrency(Account $account, TransactionJournal $journal): int { - $count = 0; + $currency = $this->getCurrency($account); + $count = 0; if ((int)$journal->transaction_currency_id !== (int)$currency->id) { $journal->transaction_currency_id = $currency->id; $journal->save(); diff --git a/app/Console/Commands/Correction/CreateAccessTokens.php b/app/Console/Commands/Correction/CreateAccessTokens.php index 7933662fe7..a8a73d1a9b 100644 --- a/app/Console/Commands/Correction/CreateAccessTokens.php +++ b/app/Console/Commands/Correction/CreateAccessTokens.php @@ -58,7 +58,6 @@ class CreateAccessTokens extends Command /** @var UserRepositoryInterface $repository */ $repository = app(UserRepositoryInterface::class); - $start = microtime(true); $count = 0; $users = $repository->all(); /** @var User $user */ @@ -72,10 +71,8 @@ class CreateAccessTokens extends Command } } if (0 === $count) { - $this->info('All access tokens OK!'); + $this->info('Correct: Verified access tokens.'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verify access tokens in %s seconds.', $end)); return 0; } diff --git a/app/Console/Commands/Correction/CreateLinkTypes.php b/app/Console/Commands/Correction/CreateLinkTypes.php index bec99fd9d5..cde1dbbd47 100644 --- a/app/Console/Commands/Correction/CreateLinkTypes.php +++ b/app/Console/Commands/Correction/CreateLinkTypes.php @@ -51,7 +51,6 @@ class CreateLinkTypes extends Command */ public function handle(): int { - $start = microtime(true); $count = 0; $set = [ 'Related' => ['relates to', 'relates to'], @@ -74,11 +73,8 @@ class CreateLinkTypes extends Command $link->save(); } if (0 === $count) { - $this->info('All link types OK!'); + $this->info('Correct: all link types are OK'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified link types in %s seconds', $end)); - return 0; } } diff --git a/app/Console/Commands/Correction/DeleteEmptyGroups.php b/app/Console/Commands/Correction/DeleteEmptyGroups.php index 6d16b1766b..27eaee4077 100644 --- a/app/Console/Commands/Correction/DeleteEmptyGroups.php +++ b/app/Console/Commands/Correction/DeleteEmptyGroups.php @@ -26,25 +26,14 @@ namespace FireflyIII\Console\Commands\Correction; use Exception; use FireflyIII\Models\TransactionGroup; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Log; /** * Class DeleteEmptyGroups */ class DeleteEmptyGroups extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Delete empty transaction groups.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:delete-empty-groups'; + protected $signature = 'firefly-iii:delete-empty-groups'; /** * Execute the console command. @@ -55,14 +44,11 @@ class DeleteEmptyGroups extends Command */ public function handle(): int { - Log::debug(sprintf('Now in %s', __METHOD__)); - $start = microtime(true); $groupIds - = TransactionGroup::leftJoin('transaction_journals', 'transaction_groups.id', '=', 'transaction_journals.transaction_group_id') - ->whereNull('transaction_journals.id')->get(['transaction_groups.id'])->pluck('id')->toArray(); + = TransactionGroup::leftJoin('transaction_journals', 'transaction_groups.id', '=', 'transaction_journals.transaction_group_id') + ->whereNull('transaction_journals.id')->get(['transaction_groups.id'])->pluck('id')->toArray(); $total = count($groupIds); - Log::debug(sprintf('Count is %d', $total)); if ($total > 0) { $this->info(sprintf('Deleted %d empty transaction group(s).', $total)); @@ -72,8 +58,9 @@ class DeleteEmptyGroups extends Command TransactionGroup::whereNull('deleted_at')->whereIn('id', $chunk)->delete(); } } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified empty groups in %s seconds', $end)); + if (0 === $total) { + $this->info('Correct: verified empty groups.'); + } return 0; } diff --git a/app/Console/Commands/Correction/DeleteEmptyJournals.php b/app/Console/Commands/Correction/DeleteEmptyJournals.php index e62b6be7d6..e0a6184881 100644 --- a/app/Console/Commands/Correction/DeleteEmptyJournals.php +++ b/app/Console/Commands/Correction/DeleteEmptyJournals.php @@ -63,7 +63,6 @@ class DeleteEmptyJournals extends Command private function deleteEmptyJournals(): void { - $start = microtime(true); $count = 0; $set = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->groupBy('transaction_journals.id') @@ -82,10 +81,8 @@ class DeleteEmptyJournals extends Command ++$count; } if (0 === $count) { - $this->info('No empty transaction journals.'); + $this->info('Correct: no empty transaction journals.'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified empty journals in %s seconds', $end)); } /** @@ -115,7 +112,7 @@ class DeleteEmptyJournals extends Command } } if (0 === $total) { - $this->info('No uneven transaction journals.'); + $this->info('Correct: no uneven transaction journals.'); } } } diff --git a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php index b559c43101..3d2dc9b753 100644 --- a/app/Console/Commands/Correction/DeleteOrphanedTransactions.php +++ b/app/Console/Commands/Correction/DeleteOrphanedTransactions.php @@ -55,12 +55,9 @@ class DeleteOrphanedTransactions extends Command */ public function handle(): int { - $start = microtime(true); $this->deleteOrphanedJournals(); $this->deleteOrphanedTransactions(); $this->deleteFromOrphanedAccounts(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified orphans in %s seconds', $end)); return 0; } @@ -93,7 +90,7 @@ class DeleteOrphanedTransactions extends Command $count++; } if (0 === $count) { - $this->info('No orphaned accounts.'); + $this->info('Correct: no orphaned accounts.'); } } @@ -105,7 +102,7 @@ class DeleteOrphanedTransactions extends Command ->get(['transaction_journals.id', 'transaction_journals.transaction_group_id']); $count = $set->count(); if (0 === $count) { - $this->info('No orphaned journals.'); + $this->info('Correct: no orphaned journals.'); } if ($count > 0) { $this->info(sprintf('Found %d orphaned journal(s).', $count)); @@ -157,7 +154,7 @@ class DeleteOrphanedTransactions extends Command } } if (0 === $count) { - $this->info('No orphaned transactions.'); + $this->info('Correct: no orphaned transactions.'); } } } diff --git a/app/Console/Commands/Correction/DeleteZeroAmount.php b/app/Console/Commands/Correction/DeleteZeroAmount.php index 12d5ebf02b..b7bf6e2c8e 100644 --- a/app/Console/Commands/Correction/DeleteZeroAmount.php +++ b/app/Console/Commands/Correction/DeleteZeroAmount.php @@ -52,7 +52,6 @@ class DeleteZeroAmount extends Command */ public function handle(): int { - $start = microtime(true); $set = Transaction::where('amount', 0)->get(['transaction_journal_id'])->pluck('transaction_journal_id')->toArray(); $set = array_unique($set); $journals = TransactionJournal::whereIn('id', $set)->get(); @@ -64,12 +63,9 @@ class DeleteZeroAmount extends Command Transaction::where('transaction_journal_id', $journal->id)->delete(); } if (0 === $journals->count()) { - $this->info('No zero-amount transaction journals.'); + $this->info('Correct: no zero-amount transaction journals.'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified zero-amount integrity in %s seconds', $end)); - return 0; } } diff --git a/app/Console/Commands/Correction/EnableCurrencies.php b/app/Console/Commands/Correction/EnableCurrencies.php index b037435a81..0901c4a565 100644 --- a/app/Console/Commands/Correction/EnableCurrencies.php +++ b/app/Console/Commands/Correction/EnableCurrencies.php @@ -37,18 +37,8 @@ use Illuminate\Support\Facades\Log; */ class EnableCurrencies extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Enables all currencies in use.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:enable-currencies'; + protected $signature = 'firefly-iii:enable-currencies'; /** * Execute the console command. @@ -57,7 +47,6 @@ class EnableCurrencies extends Command */ public function handle(): int { - $start = microtime(true); $found = []; // get all meta entries /** @var Collection $meta */ @@ -85,8 +74,8 @@ class EnableCurrencies extends Command $found[] = (int)$entry->transaction_currency_id; } - $found = array_values(array_unique($found)); - $found = array_values( + $found = array_values(array_unique($found)); + $found = array_values( array_filter( $found, function (int $currencyId) { @@ -94,22 +83,15 @@ class EnableCurrencies extends Command } ) ); - $message = sprintf('%d different currencies are currently in use.', count($found)); - $this->info($message); - Log::debug($message, $found); - $disabled = TransactionCurrency::whereIn('id', $found)->where('enabled', false)->count(); if ($disabled > 0) { $this->info(sprintf('%d were (was) still disabled. This has been corrected.', $disabled)); } if (0 === $disabled) { - $this->info('All currencies are correctly enabled or disabled.'); + $this->info('Correct: All currencies are correctly enabled or disabled.'); } TransactionCurrency::whereIn('id', $found)->update(['enabled' => true]); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified currencies in %s seconds.', $end)); - return 0; } } diff --git a/app/Console/Commands/Correction/FixAccountOrder.php b/app/Console/Commands/Correction/FixAccountOrder.php index b2b214e7f8..86f9052fbb 100644 --- a/app/Console/Commands/Correction/FixAccountOrder.php +++ b/app/Console/Commands/Correction/FixAccountOrder.php @@ -32,18 +32,8 @@ use Illuminate\Console\Command; */ class FixAccountOrder extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Make sure account order is correct.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-account-order'; + protected $signature = 'firefly-iii:fix-account-order'; private AccountRepositoryInterface $repository; @@ -55,7 +45,6 @@ class FixAccountOrder extends Command public function handle(): int { $this->stupidLaravel(); - $start = microtime(true); $users = User::get(); foreach ($users as $user) { @@ -63,8 +52,7 @@ class FixAccountOrder extends Command $this->repository->resetAccountOrder(); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verifying account order took %s seconds', $end)); + $this->info('Correct: All accounts are ordered correctly'); return 0; } diff --git a/app/Console/Commands/Correction/FixAccountTypes.php b/app/Console/Commands/Correction/FixAccountTypes.php index 1dac4a558d..53706dbd99 100644 --- a/app/Console/Commands/Correction/FixAccountTypes.php +++ b/app/Console/Commands/Correction/FixAccountTypes.php @@ -38,18 +38,8 @@ use Illuminate\Support\Facades\Log; */ class FixAccountTypes extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Make sure all journals have the correct from/to account types.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-account-types'; + protected $signature = 'firefly-iii:fix-account-types'; private int $count; private array $expected; private AccountFactory $factory; @@ -63,103 +53,23 @@ class FixAccountTypes extends Command public function handle(): int { $this->stupidLaravel(); - Log::debug('Now in fix-account-types'); - $start = microtime(true); $this->factory = app(AccountFactory::class); $this->expected = config('firefly.source_dests'); $journals = TransactionJournal::with(['TransactionType', 'transactions', 'transactions.account', 'transactions.account.accounttype'])->get(); - Log::debug(sprintf('Found %d journals to inspect.', $journals->count())); foreach ($journals as $journal) { $this->inspectJournal($journal); } if (0 === $this->count) { - Log::debug('No journals had to be fixed.'); - $this->info('All account types are OK!'); + $this->info('Correct: all account types are OK'); } if (0 !== $this->count) { Log::debug(sprintf('%d journals had to be fixed.', $this->count)); $this->info(sprintf('Acted on %d transaction(s)!', $this->count)); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verifying account types took %s seconds', $end)); - return 0; } - /** - * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is - * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should - * be called from the handle method instead of using the constructor to initialize the command. - * - - */ - private function stupidLaravel(): void - { - $this->count = 0; - } - - /** - * @param TransactionJournal $journal - * - * @throws FireflyException - */ - private function inspectJournal(TransactionJournal $journal): void - { - $transactions = $journal->transactions()->count(); - if (2 !== $transactions) { - Log::debug(sprintf('Journal has %d transactions, so can\'t fix.', $transactions)); - $this->info(sprintf('Cannot inspect transaction journal #%d because it has %d transaction(s) instead of 2.', $journal->id, $transactions)); - - return; - } - $type = $journal->transactionType->type; - $sourceTransaction = $this->getSourceTransaction($journal); - $destTransaction = $this->getDestinationTransaction($journal); - $sourceAccount = $sourceTransaction->account; - $sourceAccountType = $sourceAccount->accountType->type; - $destAccount = $destTransaction->account; - $destAccountType = $destAccount->accountType->type; - - if (!array_key_exists($type, $this->expected)) { - Log::info(sprintf('No source/destination info for transaction type %s.', $type)); - $this->info(sprintf('No source/destination info for transaction type %s.', $type)); - - return; - } - if (!array_key_exists($sourceAccountType, $this->expected[$type])) { - Log::debug(sprintf('Going to fix journal #%d', $journal->id)); - $this->fixJournal($journal, $type, $sourceTransaction, $destTransaction); - - return; - } - $expectedTypes = $this->expected[$type][$sourceAccountType]; - if (!in_array($destAccountType, $expectedTypes, true)) { - Log::debug(sprintf('Going to fix journal #%d', $journal->id)); - $this->fixJournal($journal, $type, $sourceTransaction, $destTransaction); - } - } - - /** - * @param TransactionJournal $journal - * - * @return Transaction - */ - private function getSourceTransaction(TransactionJournal $journal): Transaction - { - return $journal->transactions->firstWhere('amount', '<', 0); - } - - /** - * @param TransactionJournal $journal - * - * @return Transaction - */ - private function getDestinationTransaction(TransactionJournal $journal): Transaction - { - return $journal->transactions->firstWhere('amount', '>', 0); - } - /** * @param TransactionJournal $journal * @param string $type @@ -254,4 +164,77 @@ class FixAccountTypes extends Command break; } } + + /** + * @param TransactionJournal $journal + * + * @return Transaction + */ + private function getDestinationTransaction(TransactionJournal $journal): Transaction + { + return $journal->transactions->firstWhere('amount', '>', 0); + } + + /** + * @param TransactionJournal $journal + * + * @return Transaction + */ + private function getSourceTransaction(TransactionJournal $journal): Transaction + { + return $journal->transactions->firstWhere('amount', '<', 0); + } + + /** + * @param TransactionJournal $journal + * + * @throws FireflyException + */ + private function inspectJournal(TransactionJournal $journal): void + { + $transactions = $journal->transactions()->count(); + if (2 !== $transactions) { + Log::debug(sprintf('Journal has %d transactions, so can\'t fix.', $transactions)); + $this->info(sprintf('Cannot inspect transaction journal #%d because it has %d transaction(s) instead of 2.', $journal->id, $transactions)); + + return; + } + $type = $journal->transactionType->type; + $sourceTransaction = $this->getSourceTransaction($journal); + $destTransaction = $this->getDestinationTransaction($journal); + $sourceAccount = $sourceTransaction->account; + $sourceAccountType = $sourceAccount->accountType->type; + $destAccount = $destTransaction->account; + $destAccountType = $destAccount->accountType->type; + + if (!array_key_exists($type, $this->expected)) { + Log::info(sprintf('No source/destination info for transaction type %s.', $type)); + $this->info(sprintf('No source/destination info for transaction type %s.', $type)); + + return; + } + if (!array_key_exists($sourceAccountType, $this->expected[$type])) { + Log::debug(sprintf('Going to fix journal #%d', $journal->id)); + $this->fixJournal($journal, $type, $sourceTransaction, $destTransaction); + + return; + } + $expectedTypes = $this->expected[$type][$sourceAccountType]; + if (!in_array($destAccountType, $expectedTypes, true)) { + Log::debug(sprintf('Going to fix journal #%d', $journal->id)); + $this->fixJournal($journal, $type, $sourceTransaction, $destTransaction); + } + } + + /** + * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is + * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should + * be called from the handle method instead of using the constructor to initialize the command. + * + + */ + private function stupidLaravel(): void + { + $this->count = 0; + } } diff --git a/app/Console/Commands/Correction/FixFrontpageAccounts.php b/app/Console/Commands/Correction/FixFrontpageAccounts.php index 3175bc0e3d..970d570acb 100644 --- a/app/Console/Commands/Correction/FixFrontpageAccounts.php +++ b/app/Console/Commands/Correction/FixFrontpageAccounts.php @@ -36,18 +36,8 @@ use Illuminate\Console\Command; */ class FixFrontpageAccounts extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Fixes a preference that may include deleted accounts or accounts of another type.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-frontpage-accounts'; + protected $signature = 'firefly-iii:fix-frontpage-accounts'; /** * Execute the console command. @@ -56,8 +46,6 @@ class FixFrontpageAccounts extends Command */ public function handle(): int { - $start = microtime(true); - $users = User::get(); /** @var User $user */ foreach ($users as $user) { @@ -66,8 +54,7 @@ class FixFrontpageAccounts extends Command $this->fixPreference($preference); } } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verifying account preferences took %s seconds', $end)); + $this->info('Correct: account preferences are OK'); return 0; } diff --git a/app/Console/Commands/Correction/FixGroupAccounts.php b/app/Console/Commands/Correction/FixGroupAccounts.php index 31fa005c63..d2634990e0 100644 --- a/app/Console/Commands/Correction/FixGroupAccounts.php +++ b/app/Console/Commands/Correction/FixGroupAccounts.php @@ -36,18 +36,8 @@ use Illuminate\Console\Command; */ class FixGroupAccounts extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Unify the source / destination accounts of split groups.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:unify-group-accounts'; + protected $signature = 'firefly-iii:unify-group-accounts'; /** * Execute the console command. @@ -72,7 +62,7 @@ class FixGroupAccounts extends Command $handler->unifyAccounts($event); } - $this->line('Updated inconsistent transaction groups.'); + $this->info('Correct: updated possible inconsistent transaction groups.'); return 0; } diff --git a/app/Console/Commands/Correction/FixIbans.php b/app/Console/Commands/Correction/FixIbans.php index 4b3e70a289..ea8fb18154 100644 --- a/app/Console/Commands/Correction/FixIbans.php +++ b/app/Console/Commands/Correction/FixIbans.php @@ -34,18 +34,9 @@ use Illuminate\Support\Collection; */ class FixIbans extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Removes spaces from IBANs'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-ibans'; + protected $signature = 'firefly-iii:fix-ibans'; + private int $count = 0; /** * Execute the console command. @@ -57,6 +48,9 @@ class FixIbans extends Command $accounts = Account::whereNotNull('iban')->get(); $this->filterIbans($accounts); $this->countAndCorrectIbans($accounts); + if (0 === $this->count) { + $this->info('Correct: All IBANs are valid.'); + } return 0; } @@ -99,6 +93,7 @@ class FixIbans extends Command ); $account->iban = null; $account->save(); + $this->count++; } } @@ -124,6 +119,7 @@ class FixIbans extends Command $account->iban = $iban; $account->save(); $this->line(sprintf('Removed spaces from IBAN of account #%d', $account->id)); + $this->count++; } } } diff --git a/app/Console/Commands/Correction/FixLongDescriptions.php b/app/Console/Commands/Correction/FixLongDescriptions.php index 32fa810ec7..e08b78531f 100644 --- a/app/Console/Commands/Correction/FixLongDescriptions.php +++ b/app/Console/Commands/Correction/FixLongDescriptions.php @@ -34,18 +34,8 @@ use Illuminate\Console\Command; class FixLongDescriptions extends Command { private const MAX_LENGTH = 1000; - /** - * The console command description. - * - * @var string - */ protected $description = 'Fixes long descriptions in journals and groups.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-long-descriptions'; + protected $signature = 'firefly-iii:fix-long-descriptions'; /** * Execute the console command. @@ -54,14 +44,15 @@ class FixLongDescriptions extends Command */ public function handle(): int { - $start = microtime(true); $journals = TransactionJournal::get(['id', 'description']); + $count = 0; /** @var TransactionJournal $journal */ foreach ($journals as $journal) { if (strlen($journal->description) > self::MAX_LENGTH) { $journal->description = substr($journal->description, 0, self::MAX_LENGTH); $journal->save(); $this->line(sprintf('Truncated description of transaction journal #%d', $journal->id)); + $count++; } } @@ -72,11 +63,12 @@ class FixLongDescriptions extends Command $group->title = substr($group->title, 0, self::MAX_LENGTH); $group->save(); $this->line(sprintf('Truncated description of transaction group #%d', $group->id)); + $count++; } } - $end = round(microtime(true) - $start, 2); - $this->info('Verified all transaction group and journal title lengths.'); - $this->info(sprintf('Took %s seconds.', $end)); + if (0 === $count) { + $this->info('Correct: all transaction group and journal title lengths are within bounds.'); + } return 0; } diff --git a/app/Console/Commands/Correction/FixPiggies.php b/app/Console/Commands/Correction/FixPiggies.php index a7f98d9fb9..d1f871f040 100644 --- a/app/Console/Commands/Correction/FixPiggies.php +++ b/app/Console/Commands/Correction/FixPiggies.php @@ -34,18 +34,8 @@ use Illuminate\Console\Command; */ class FixPiggies extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Fixes common issues with piggy banks.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-piggies'; + protected $signature = 'firefly-iii:fix-piggies'; /** * Execute the console command. @@ -55,7 +45,6 @@ class FixPiggies extends Command public function handle(): int { $count = 0; - $start = microtime(true); $set = PiggyBankEvent::with(['PiggyBank', 'TransactionJournal'])->get(); /** @var PiggyBankEvent $event */ @@ -74,15 +63,12 @@ class FixPiggies extends Command } } if (0 === $count) { - $this->line('All piggy bank events are correct.'); + $this->info('Correct: all piggy bank events are OK.'); } if (0 !== $count) { $this->line(sprintf('Fixed %d piggy bank event(s).', $count)); } - $end = round(microtime(true) - $start, 2); - $this->line(sprintf('Verified the content of %d piggy bank events in %s seconds.', $set->count(), $end)); - return 0; } } diff --git a/app/Console/Commands/Correction/FixRecurringTransactions.php b/app/Console/Commands/Correction/FixRecurringTransactions.php index 05d182dfc8..b6599a6149 100644 --- a/app/Console/Commands/Correction/FixRecurringTransactions.php +++ b/app/Console/Commands/Correction/FixRecurringTransactions.php @@ -37,22 +37,11 @@ use Illuminate\Console\Command; */ class FixRecurringTransactions extends Command { - /** - * The console command description. - * - * @var string - */ - protected $description = 'Fixes recurring transactions with the wrong transaction type.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-recurring-transactions'; - /** @var RecurringRepositoryInterface */ - private $recurringRepos; - /** @var UserRepositoryInterface */ - private $userRepos; + protected $description = 'Fixes recurring transactions with the wrong transaction type.'; + protected $signature = 'firefly-iii:fix-recurring-transactions'; + private int $count = 0; + private RecurringRepositoryInterface $recurringRepos; + private UserRepositoryInterface $userRepos; /** * Execute the console command. @@ -61,11 +50,11 @@ class FixRecurringTransactions extends Command */ public function handle(): int { - $start = microtime(true); $this->stupidLaravel(); $this->correctTransactions(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Corrected recurring transactions in %s seconds.', $end)); + if (0 === $this->count) { + $this->info('Correct: all recurring transactions are OK.'); + } return 0; } @@ -111,6 +100,7 @@ class FixRecurringTransactions extends Command if (null !== $transactionType) { $recurrence->transaction_type_id = $transactionType->id; $recurrence->save(); + $this->count++; } } } diff --git a/app/Console/Commands/Correction/FixTransactionTypes.php b/app/Console/Commands/Correction/FixTransactionTypes.php index c818bd6ca1..3fb5fa4f6e 100644 --- a/app/Console/Commands/Correction/FixTransactionTypes.php +++ b/app/Console/Commands/Correction/FixTransactionTypes.php @@ -37,18 +37,8 @@ use Illuminate\Support\Collection; */ class FixTransactionTypes extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Make sure all transactions are of the correct type, based on source + dest.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-transaction-types'; + protected $signature = 'firefly-iii:fix-transaction-types'; /** * Execute the console command. @@ -57,7 +47,6 @@ class FixTransactionTypes extends Command */ public function handle(): int { - $start = microtime(true); $count = 0; $journals = $this->collectJournals(); /** @var TransactionJournal $journal */ @@ -67,13 +56,12 @@ class FixTransactionTypes extends Command $count++; } } - $end = round(microtime(true) - $start, 2); if ($count > 0) { - $this->info(sprintf('Corrected transaction type of %d transaction journals in %s seconds.', $count, $end)); + $this->info('Corrected transaction type of %d transaction journals.', $count); return 0; } - $this->line(sprintf('All transaction journals are of the correct transaction type (in %s seconds).', $end)); + $this->info('Correct: all transaction journals are of the correct transaction type'); return 0; } diff --git a/app/Console/Commands/Correction/FixUnevenAmount.php b/app/Console/Commands/Correction/FixUnevenAmount.php index fdfc75ad8e..e947c7fd76 100644 --- a/app/Console/Commands/Correction/FixUnevenAmount.php +++ b/app/Console/Commands/Correction/FixUnevenAmount.php @@ -27,7 +27,6 @@ use DB; use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Log; use stdClass; /** @@ -35,18 +34,8 @@ use stdClass; */ class FixUnevenAmount extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Fix journals with uneven amounts.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-uneven-amount'; + protected $signature = 'firefly-iii:fix-uneven-amount'; /** * Execute the console command. @@ -55,10 +44,7 @@ class FixUnevenAmount extends Command */ public function handle(): int { - Log::debug(sprintf('Now in %s', __METHOD__)); - $start = microtime(true); - $count = 0; - // get invalid journals + $count = 0; $journals = DB::table('transactions') ->groupBy('transaction_journal_id') ->whereNull('deleted_at') @@ -74,12 +60,9 @@ class FixUnevenAmount extends Command } } if (0 === $count) { - $this->info('Amount integrity OK!'); + $this->info('Correct: Database amount integrity is OK'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified amount integrity in %s seconds', $end)); - return 0; } diff --git a/app/Console/Commands/Correction/RemoveBills.php b/app/Console/Commands/Correction/RemoveBills.php index 4e4d6fc12c..227d0367b1 100644 --- a/app/Console/Commands/Correction/RemoveBills.php +++ b/app/Console/Commands/Correction/RemoveBills.php @@ -32,18 +32,8 @@ use Illuminate\Console\Command; */ class RemoveBills extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Remove bills from transactions that shouldn\'t have one.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:remove-bills'; + protected $signature = 'firefly-iii:remove-bills'; /** * Execute the console command. @@ -52,7 +42,6 @@ class RemoveBills extends Command */ public function handle(): int { - $start = microtime(true); /** @var TransactionType|null $withdrawal */ $withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first(); if (null === $withdrawal) { @@ -65,14 +54,10 @@ class RemoveBills extends Command $journal->bill_id = null; $journal->save(); } - if (0 === $journals->count()) { - $this->info('All transaction journals have correct bill information.'); - } if ($journals->count() > 0) { $this->info('Fixed all transaction journals so they have correct bill information.'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified bills / journals in %s seconds', $end)); + $this->info('Correct: verified bills / journals in %s seconds'); return 0; } diff --git a/app/Console/Commands/Correction/RenameMetaFields.php b/app/Console/Commands/Correction/RenameMetaFields.php index ff070f3707..d8d4c09dc6 100644 --- a/app/Console/Commands/Correction/RenameMetaFields.php +++ b/app/Console/Commands/Correction/RenameMetaFields.php @@ -31,18 +31,8 @@ use Illuminate\Console\Command; */ class RenameMetaFields extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Rename changed meta fields.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:rename-meta-fields'; + protected $signature = 'firefly-iii:rename-meta-fields'; private int $count; @@ -54,7 +44,6 @@ class RenameMetaFields extends Command public function handle(): int { $this->count = 0; - $start = microtime(true); $changes = [ 'original-source' => 'original_source', @@ -74,15 +63,11 @@ class RenameMetaFields extends Command $this->rename($original, $update); } if (0 === $this->count) { - $this->line('All meta fields are correct.'); + $this->info('Correct: all meta fields are correct.'); } if (0 !== $this->count) { - $this->line(sprintf('Renamed %d meta field(s).', $this->count)); + $this->info(sprintf('Renamed %d meta field(s).', $this->count)); } - - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Renamed meta fields in %s seconds', $end)); - return 0; } diff --git a/app/Console/Commands/Correction/TransferBudgets.php b/app/Console/Commands/Correction/TransferBudgets.php index 99848de290..b6ad50ae35 100644 --- a/app/Console/Commands/Correction/TransferBudgets.php +++ b/app/Console/Commands/Correction/TransferBudgets.php @@ -33,18 +33,8 @@ use Illuminate\Support\Facades\Log; */ class TransferBudgets extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Removes budgets from transfers.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:fix-transfer-budgets'; + protected $signature = 'firefly-iii:fix-transfer-budgets'; /** * Execute the console command. @@ -53,7 +43,6 @@ class TransferBudgets extends Command */ public function handle(): int { - $start = microtime(true); $set = TransactionJournal::distinct() ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->leftJoin('budget_transaction_journal', 'transaction_journals.id', '=', 'budget_transaction_journal.transaction_journal_id') @@ -69,8 +58,7 @@ class TransferBudgets extends Command $count++; } if (0 === $count) { - $message = 'No invalid budget/journal entries.'; - Log::debug($message); + $message = 'Correct: no invalid budget/journal entries.'; $this->info($message); } if (0 !== $count) { @@ -78,9 +66,6 @@ class TransferBudgets extends Command Log::debug($message); $this->line($message); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified budget/journals in %s seconds.', $end)); - return 0; } } diff --git a/app/Console/Commands/Correction/TriggerCreditCalculation.php b/app/Console/Commands/Correction/TriggerCreditCalculation.php index 0b781f3ad5..bda570cf42 100644 --- a/app/Console/Commands/Correction/TriggerCreditCalculation.php +++ b/app/Console/Commands/Correction/TriggerCreditCalculation.php @@ -15,18 +15,8 @@ use Illuminate\Support\Facades\Log; */ class TriggerCreditCalculation extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Triggers the credit recalculation service for liabilities.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:trigger-credit-recalculation'; + protected $signature = 'firefly-iii:trigger-credit-recalculation'; /** * Execute the console command. @@ -59,7 +49,6 @@ class TriggerCreditCalculation extends Command ->whereIn('account_types.type', config('firefly.valid_liabilities')) ->get(['accounts.*']); foreach ($accounts as $account) { - Log::debug(sprintf('Processing account #%d ("%s")', $account->id, $account->name)); $this->processAccount($account); } } diff --git a/app/Console/Commands/Integrity/CreateGroupMemberships.php b/app/Console/Commands/Integrity/CreateGroupMemberships.php index 336d194152..9850e37d3f 100644 --- a/app/Console/Commands/Integrity/CreateGroupMemberships.php +++ b/app/Console/Commands/Integrity/CreateGroupMemberships.php @@ -38,18 +38,8 @@ use Illuminate\Support\Facades\Log; class CreateGroupMemberships extends Command { public const CONFIG_NAME = '560_create_group_memberships'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Update group memberships'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:create-group-memberships'; + protected $signature = 'firefly-iii:create-group-memberships'; /** * TODO move to helper. @@ -64,7 +54,6 @@ class CreateGroupMemberships extends Command $userGroup = UserGroup::where('title', $user->email)->first(); if (null === $userGroup) { $userGroup = UserGroup::create(['title' => $user->email]); - Log::debug(sprintf('Created new user group #%d ("%s")', $userGroup->id, $userGroup->title)); } $userRole = UserRole::where('title', UserRole::OWNER)->first(); @@ -83,15 +72,11 @@ class CreateGroupMemberships extends Command 'user_group_id' => $userGroup->id, ] ); - Log::debug('Created new membership.'); } if (null === $user->user_group_id) { $user->user_group_id = $userGroup->id; $user->save(); - Log::debug('Put user in default group.'); } - - Log::debug(sprintf('User #%d now has main group.', $user->id)); } /** @@ -102,12 +87,8 @@ class CreateGroupMemberships extends Command */ public function handle(): int { - $start = microtime(true); - $this->createGroupMemberships(); - - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Validated group memberships in %s seconds.', $end)); + $this->info('Correct: validated group memberships'); return 0; } @@ -121,9 +102,7 @@ class CreateGroupMemberships extends Command $users = User::get(); /** @var User $user */ foreach ($users as $user) { - Log::debug(sprintf('Manage group memberships for user #%d', $user->id)); self::createGroupMembership($user); - Log::debug(sprintf('Done with user #%d', $user->id)); } } } diff --git a/app/Console/Commands/Integrity/ReportEmptyObjects.php b/app/Console/Commands/Integrity/ReportEmptyObjects.php index ea3e2e342f..18424eb281 100644 --- a/app/Console/Commands/Integrity/ReportEmptyObjects.php +++ b/app/Console/Commands/Integrity/ReportEmptyObjects.php @@ -55,14 +55,11 @@ class ReportEmptyObjects extends Command */ public function handle(): int { - $start = microtime(true); $this->reportEmptyBudgets(); $this->reportEmptyCategories(); $this->reportEmptyTags(); $this->reportAccounts(); $this->reportBudgetLimits(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Report on empty objects finished in %s seconds', $end)); return 0; } diff --git a/app/Console/Commands/Integrity/ReportSum.php b/app/Console/Commands/Integrity/ReportSum.php index 5b5bcb8dc1..01422536d4 100644 --- a/app/Console/Commands/Integrity/ReportSum.php +++ b/app/Console/Commands/Integrity/ReportSum.php @@ -32,18 +32,8 @@ use Illuminate\Console\Command; */ class ReportSum extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Report on the total sum of transactions. Must be 0.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:report-sum'; + protected $signature = 'firefly-iii:report-sum'; /** * Execute the console command. @@ -62,7 +52,6 @@ class ReportSum extends Command */ private function reportSum(): void { - $start = microtime(true); /** @var UserRepositoryInterface $userRepository */ $userRepository = app(UserRepositoryInterface::class); @@ -74,10 +63,8 @@ class ReportSum extends Command $this->error($message); } if (0 === bccomp($sum, '0')) { - $this->info(sprintf('Amount integrity OK for user #%d', $user->id)); + $this->info(sprintf('Correct: Amount integrity OK for user #%d', $user->id)); } } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Report on total sum finished in %s seconds', $end)); } } diff --git a/app/Console/Commands/Integrity/RestoreOAuthKeys.php b/app/Console/Commands/Integrity/RestoreOAuthKeys.php index bbee5e20b7..49f0f915d7 100644 --- a/app/Console/Commands/Integrity/RestoreOAuthKeys.php +++ b/app/Console/Commands/Integrity/RestoreOAuthKeys.php @@ -26,25 +26,14 @@ namespace FireflyIII\Console\Commands\Integrity; use FireflyIII\Support\System\OAuthKeys; use Illuminate\Console\Command; -use Illuminate\Support\Facades\Log; /** * Class RestoreOAuthKeys */ class RestoreOAuthKeys extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Will restore the OAuth keys generated for the system.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:restore-oauth-keys'; + protected $signature = 'firefly-iii:restore-oauth-keys'; /** * Execute the console command. @@ -95,38 +84,33 @@ class RestoreOAuthKeys extends Command */ private function restoreOAuthKeys(): void { - Log::debug('Going to restoreOAuthKeys()'); if (!$this->keysInDatabase() && !$this->keysOnDrive()) { - Log::debug('Keys are not in DB and keys are not on the drive.'); $this->generateKeys(); $this->storeKeysInDB(); - $this->line('Generated and stored new keys.'); + $this->line('Correct: generated and stored new keys.'); return; } if ($this->keysInDatabase() && !$this->keysOnDrive()) { - Log::debug('Keys are in DB and keys are not on the drive. Restore.'); $result = $this->restoreKeysFromDB(); if (true === $result) { - $this->line('Restored OAuth keys from database.'); + $this->line('Correct: restored OAuth keys from database.'); return; } - app('log')->warning('Could not restore keys. Will create new ones.'); $this->generateKeys(); $this->storeKeysInDB(); - $this->line('Generated and stored new keys.'); + $this->line('Correct: generated and stored new keys.'); return; } if (!$this->keysInDatabase() && $this->keysOnDrive()) { - Log::debug('Keys are not in DB and keys are on the drive. Save in DB.'); $this->storeKeysInDB(); - $this->line('Stored OAuth keys in database.'); + $this->line('Correct: stored OAuth keys in database.'); return; } - $this->line('OAuth keys are OK'); + $this->line('Correct: OAuth keys are OK'); } /** diff --git a/app/Console/Commands/Integrity/UpdateGroupInformation.php b/app/Console/Commands/Integrity/UpdateGroupInformation.php index 1fc377d7f8..f2ad93f02c 100644 --- a/app/Console/Commands/Integrity/UpdateGroupInformation.php +++ b/app/Console/Commands/Integrity/UpdateGroupInformation.php @@ -48,18 +48,8 @@ use Illuminate\Database\QueryException; */ class UpdateGroupInformation extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Makes sure that every object is linked to a group'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:upgrade-group-information'; + protected $signature = 'firefly-iii:upgrade-group-information'; /** * Execute the console command. @@ -126,7 +116,7 @@ class UpdateGroupInformation extends Command return; } if (0 !== $result) { - $this->line(sprintf('Moved %d %s objects to the correct group.', $result, str_replace('FireflyIII\\Models\\', '', $className))); + $this->info(sprintf('Correct: Moved %d %s objects to the correct group.', $result, str_replace('FireflyIII\\Models\\', '', $className))); } } } diff --git a/app/Console/Commands/System/ForceDecimalSize.php b/app/Console/Commands/System/ForceDecimalSize.php index 41bf0c7928..211251c743 100644 --- a/app/Console/Commands/System/ForceDecimalSize.php +++ b/app/Console/Commands/System/ForceDecimalSize.php @@ -103,7 +103,6 @@ class ForceDecimalSize extends Command $this->correctAmounts(); $this->updateDecimals(); } - $this->line('Done!'); return 0; } diff --git a/app/Console/Commands/System/ForceMigration.php b/app/Console/Commands/System/ForceMigration.php index 7abd2f2da7..4677996c7c 100644 --- a/app/Console/Commands/System/ForceMigration.php +++ b/app/Console/Commands/System/ForceMigration.php @@ -83,12 +83,10 @@ class ForceMigration extends Command $this->line('Dropping "migrations" table...'); sleep(2); Schema::dropIfExists('migrations'); - $this->line('Done!'); $this->line('Re-run all migrations...'); Artisan::call('migrate', ['--seed' => true]); sleep(2); $this->line(''); - $this->info('Done!'); $this->line('There is a good chance you just saw a lot of error messages.'); $this->line('No need to panic yet. First try to access Firefly III (again).'); $this->line('The issue, whatever it was, may have been solved now.'); diff --git a/app/Console/Commands/Upgrade/AccountCurrencies.php b/app/Console/Commands/Upgrade/AccountCurrencies.php index 276e3e7668..512ffafd59 100644 --- a/app/Console/Commands/Upgrade/AccountCurrencies.php +++ b/app/Console/Commands/Upgrade/AccountCurrencies.php @@ -43,54 +43,35 @@ use Psr\Container\NotFoundExceptionInterface; class AccountCurrencies extends Command { public const CONFIG_NAME = '480_account_currencies'; - /** - * The console command description. - * - * @var string - */ + protected $description = 'Give all accounts proper currency info.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}'; - /** @var AccountRepositoryInterface */ - private $accountRepos; - /** @var int */ - private $count; - /** @var UserRepositoryInterface */ - private $userRepos; + protected $signature = 'firefly-iii:account-currencies {--F|force : Force the execution of this command.}'; + private AccountRepositoryInterface $accountRepos; + private int $count; + private UserRepositoryInterface $userRepos; /** * Each (asset) account must have a reference to a preferred currency. If the account does not have one, it's forced upon the account. * * @return int - * @throws ContainerExceptionInterface - * @throws FireflyException - * @throws NotFoundExceptionInterface */ public function handle(): int { - Log::debug('Now in handle()'); $this->stupidLaravel(); - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } $this->updateAccountCurrencies(); if (0 === $this->count) { - $this->line('All accounts are OK.'); + $this->info('Correct: all account currencies are OK.'); } if (0 !== $this->count) { $this->line(sprintf('Corrected %d account(s).', $this->count)); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified and fixed account currencies in %s seconds.', $end)); $this->markAsExecuted(); return 0; @@ -124,7 +105,6 @@ class AccountCurrencies extends Command * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should * be called from the handle method instead of using the constructor to initialize the command. * - */ private function stupidLaravel(): void { @@ -139,23 +119,16 @@ class AccountCurrencies extends Command */ private function updateAccount(Account $account, TransactionCurrency $currency): void { - Log::debug(sprintf('Now in updateAccount(%d, %s)', $account->id, $currency->code)); $this->accountRepos->setUser($account->user); - $accountCurrency = (int)$this->accountRepos->getMetaValue($account, 'currency_id'); - Log::debug(sprintf('Account currency is #%d', $accountCurrency)); - - $openingBalance = $this->accountRepos->getOpeningBalance($account); - $obCurrency = 0; + $openingBalance = $this->accountRepos->getOpeningBalance($account); + $obCurrency = 0; if (null !== $openingBalance) { $obCurrency = (int)$openingBalance->transaction_currency_id; - Log::debug('Account has opening balance.'); } - Log::debug(sprintf('Account OB currency is #%d.', $obCurrency)); // both 0? set to default currency: if (0 === $accountCurrency && 0 === $obCurrency) { - Log::debug(sprintf('Both currencies are 0, so reset to #%d (%s)', $currency->id, $currency->code)); AccountMeta::where('account_id', $account->id)->where('name', 'currency_id')->forceDelete(); AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $currency->id]); $this->line(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $currency->code)); @@ -166,7 +139,6 @@ class AccountCurrencies extends Command // account is set to 0, opening balance is not? if (0 === $accountCurrency && $obCurrency > 0) { - Log::debug(sprintf('Account is #0, OB is #%d, so set account to OB as well', $obCurrency)); AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]); $this->line(sprintf('Account #%d ("%s") now has a currency setting (#%d).', $account->id, $account->name, $obCurrency)); $this->count++; @@ -175,7 +147,6 @@ class AccountCurrencies extends Command } // do not match and opening balance id is not null. if ($accountCurrency !== $obCurrency && null !== $openingBalance) { - Log::debug(sprintf('Account (#%d) and OB currency (#%d) are different. Overrule OB, set to account currency.', $accountCurrency, $obCurrency)); // update opening balance: $openingBalance->transaction_currency_id = $accountCurrency; $openingBalance->save(); @@ -190,7 +161,6 @@ class AccountCurrencies extends Command return; } - Log::debug('No changes necessary for this account.'); } /** @@ -198,10 +168,8 @@ class AccountCurrencies extends Command */ private function updateAccountCurrencies(): void { - Log::debug('Now in updateAccountCurrencies()'); $users = $this->userRepos->all(); $defaultCurrencyCode = (string)config('firefly.default_currency', 'EUR'); - Log::debug(sprintf('Default currency is %s', $defaultCurrencyCode)); foreach ($users as $user) { $this->updateCurrenciesForUser($user, $defaultCurrencyCode); } @@ -215,7 +183,6 @@ class AccountCurrencies extends Command */ private function updateCurrenciesForUser(User $user, string $systemCurrencyCode): void { - Log::debug(sprintf('Now in updateCurrenciesForUser(%s, %s)', $user->email, $systemCurrencyCode)); $this->accountRepos->setUser($user); $accounts = $this->accountRepos->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]); @@ -224,7 +191,6 @@ class AccountCurrencies extends Command if (!is_string($defaultCurrencyCode)) { $defaultCurrencyCode = $systemCurrencyCode; } - Log::debug(sprintf('Users currency pref is %s', $defaultCurrencyCode)); /** @var TransactionCurrency|null $defaultCurrency */ $defaultCurrency = TransactionCurrency::where('code', $defaultCurrencyCode)->first(); diff --git a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php index a468b6f9e9..7ccfa3fe00 100644 --- a/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php +++ b/app/Console/Commands/Upgrade/AppendBudgetLimitPeriods.php @@ -56,20 +56,15 @@ class AppendBudgetLimitPeriods extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } $this->theresNoLimit(); - $this->markAsExecuted(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Fixed budget limits in %s seconds.', $end)); - return 0; } diff --git a/app/Console/Commands/Upgrade/BackToJournals.php b/app/Console/Commands/Upgrade/BackToJournals.php index cf3ddadad9..c5bcba2a64 100644 --- a/app/Console/Commands/Upgrade/BackToJournals.php +++ b/app/Console/Commands/Upgrade/BackToJournals.php @@ -64,12 +64,11 @@ class BackToJournals extends Command */ public function handle(): int { - $start = microtime(true); if (!$this->isMigrated()) { $this->error('Please run firefly-iii:migrate-to-groups first.'); } if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -79,8 +78,7 @@ class BackToJournals extends Command $this->migrateAll(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Updated category and budget info for all transaction journals in %s seconds.', $end)); + $this->info('Correct: updated category and budget info for all transaction journals'); $this->markAsExecuted(); return 0; @@ -159,7 +157,6 @@ class BackToJournals extends Command */ private function migrateAll(): void { - Log::debug('Now in migrateAll()'); $this->migrateBudgets(); $this->migrateCategories(); @@ -225,19 +222,15 @@ class BackToJournals extends Command */ private function migrateCategories(): void { - Log::debug('Now in migrateCategories()'); $journals = new Collection(); $allIds = $this->getIdsForCategories(); - Log::debug(sprintf('Total: %d', count($allIds))); $chunks = array_chunk($allIds, 500); foreach ($chunks as $chunk) { - Log::debug('Now doing a chunk.'); $collected = TransactionJournal::whereIn('id', $chunk)->with(['transactions', 'categories', 'transactions.categories'])->get(); $journals = $journals->merge($collected); } - $this->line(sprintf('Check %d transaction journal(s) for category info.', count($journals))); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $this->migrateCategoriesForJournal($journal); diff --git a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php index 6586001495..3203af7a39 100644 --- a/app/Console/Commands/Upgrade/BudgetLimitCurrency.php +++ b/app/Console/Commands/Upgrade/BudgetLimitCurrency.php @@ -58,10 +58,8 @@ class BudgetLimitCurrency extends Command */ public function handle(): int { - $start = microtime(true); - if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -88,11 +86,8 @@ class BudgetLimitCurrency extends Command } } if (0 === $count) { - $this->info('All budget limits are correct.'); + $this->info('Correct: all budget limits are OK.'); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified budget limits in %s seconds.', $end)); - $this->markAsExecuted(); return 0; diff --git a/app/Console/Commands/Upgrade/CCLiabilities.php b/app/Console/Commands/Upgrade/CCLiabilities.php index a2b5d0e9ba..9b9a3b1aed 100644 --- a/app/Console/Commands/Upgrade/CCLiabilities.php +++ b/app/Console/Commands/Upgrade/CCLiabilities.php @@ -37,18 +37,8 @@ use Psr\Container\NotFoundExceptionInterface; class CCLiabilities extends Command { public const CONFIG_NAME = '480_cc_liabilities'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Convert old credit card liabilities.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}'; + protected $signature = 'firefly-iii:cc-liabilities {--F|force : Force the execution of this command.}'; /** * Execute the console command. @@ -62,9 +52,8 @@ class CCLiabilities extends Command { $start = microtime(true); - if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -73,7 +62,8 @@ class CCLiabilities extends Command $ccType = AccountType::where('type', AccountType::CREDITCARD)->first(); $debtType = AccountType::where('type', AccountType::DEBT)->first(); if (null === $ccType || null === $debtType) { - $this->info('No incorrectly stored credit card liabilities.'); + $this->info('Correct: no incorrectly stored credit card liabilities.'); + $this->markAsExecuted(); return 0; } @@ -88,7 +78,7 @@ class CCLiabilities extends Command $this->info('Credit card liability types are no longer supported and have been converted to generic debts. See: https://bit.ly/FF3-credit-cards'); } if (0 === $accounts->count()) { - $this->info('No incorrectly stored credit card liabilities.'); + $this->info('Correct: no incorrectly stored credit card liabilities.'); } $end = round(microtime(true) - $start, 2); $this->info(sprintf('Verified credit card liabilities in %s seconds', $end)); diff --git a/app/Console/Commands/Upgrade/DecryptDatabase.php b/app/Console/Commands/Upgrade/DecryptDatabase.php index 443300be09..831b1d6576 100644 --- a/app/Console/Commands/Upgrade/DecryptDatabase.php +++ b/app/Console/Commands/Upgrade/DecryptDatabase.php @@ -41,18 +41,8 @@ use stdClass; */ class DecryptDatabase extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Decrypts the database.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:decrypt-all'; + protected $signature = 'firefly-iii:decrypt-all'; /** * Execute the console command. @@ -61,7 +51,6 @@ class DecryptDatabase extends Command */ public function handle(): int { - $this->line('Going to decrypt the database.'); $tables = [ 'accounts' => ['name', 'iban'], 'attachments' => ['filename', 'mime', 'title', 'description'], @@ -82,8 +71,6 @@ class DecryptDatabase extends Command foreach ($tables as $table => $fields) { $this->decryptTable($table, $fields); } - $this->info('Done!'); - return 0; } @@ -172,14 +159,14 @@ class DecryptDatabase extends Command private function decryptTable(string $table, array $fields): void { if ($this->isDecrypted($table)) { - $this->info(sprintf('No decryption required for table "%s".', $table)); + $this->info(sprintf('Correct: no decryption required for table "%s".', $table)); return; } foreach ($fields as $field) { $this->decryptField($table, $field); } - $this->line(sprintf('Decrypted the data in table "%s".', $table)); + $this->line(sprintf('Correct: decrypted the data in table "%s".', $table)); // mark as decrypted: $configName = sprintf('is_decrypted_%s', $table); app('fireflyconfig')->set($configName, true); diff --git a/app/Console/Commands/Upgrade/FixPostgresSequences.php b/app/Console/Commands/Upgrade/FixPostgresSequences.php index 95f7ea4127..b3f0fe08a4 100644 --- a/app/Console/Commands/Upgrade/FixPostgresSequences.php +++ b/app/Console/Commands/Upgrade/FixPostgresSequences.php @@ -53,8 +53,6 @@ class FixPostgresSequences extends Command public function handle(): int { if (DB::connection()->getName() !== 'pgsql') { - $this->info('Command executed successfully.'); - return 0; } $this->line('Going to verify PostgreSQL table sequences.'); diff --git a/app/Console/Commands/Upgrade/MigrateAttachments.php b/app/Console/Commands/Upgrade/MigrateAttachments.php index 7bcbc90d92..4ab0eb43d3 100644 --- a/app/Console/Commands/Upgrade/MigrateAttachments.php +++ b/app/Console/Commands/Upgrade/MigrateAttachments.php @@ -62,7 +62,7 @@ class MigrateAttachments extends Command { $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -94,7 +94,7 @@ class MigrateAttachments extends Command } } if (0 === $count) { - $this->line('All attachments are OK.'); + $this->info('Correct: all attachments are OK.'); } if (0 !== $count) { $this->line(sprintf('Updated %d attachment(s).', $count)); diff --git a/app/Console/Commands/Upgrade/MigrateJournalNotes.php b/app/Console/Commands/Upgrade/MigrateJournalNotes.php index 125a06fd36..72c91d4cbc 100644 --- a/app/Console/Commands/Upgrade/MigrateJournalNotes.php +++ b/app/Console/Commands/Upgrade/MigrateJournalNotes.php @@ -63,7 +63,7 @@ class MigrateJournalNotes extends Command $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -88,7 +88,7 @@ class MigrateJournalNotes extends Command } if (0 === $count) { - $this->line('No notes to migrate.'); + $this->info('Correct: No notes to migrate.'); } if (0 !== $count) { $this->line(sprintf('Migrated %d note(s).', $count)); diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php index da09efbfcb..3e16eb7e78 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceMeta.php @@ -63,16 +63,15 @@ class MigrateRecurrenceMeta extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } $count = $this->migrateMetaData(); if (0 === $count) { - $this->line('No recurrence meta data migrated.'); + $this->info('Correct: no recurrence meta data migrated.'); } if ($count > 0) { $this->line(sprintf('Migrated %d meta data entries', $count)); @@ -80,9 +79,6 @@ class MigrateRecurrenceMeta extends Command $this->markAsExecuted(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Migrated recurrence meta data in %s seconds.', $end)); - return 0; } diff --git a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php index fadff18491..29ee8dcfff 100644 --- a/app/Console/Commands/Upgrade/MigrateRecurrenceType.php +++ b/app/Console/Commands/Upgrade/MigrateRecurrenceType.php @@ -61,7 +61,6 @@ class MigrateRecurrenceType extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { $this->warn('This command has already been executed.'); @@ -69,11 +68,8 @@ class MigrateRecurrenceType extends Command } $this->migrateTypes(); - $this->markAsExecuted(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Update recurring transaction types in %s seconds.', $end)); return 0; } diff --git a/app/Console/Commands/Upgrade/MigrateTagLocations.php b/app/Console/Commands/Upgrade/MigrateTagLocations.php index 8e19076565..4b4b1d9917 100644 --- a/app/Console/Commands/Upgrade/MigrateTagLocations.php +++ b/app/Console/Commands/Upgrade/MigrateTagLocations.php @@ -60,18 +60,14 @@ class MigrateTagLocations extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } $this->migrateTagLocations(); $this->markAsExecuted(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Migrated tag locations in %s seconds.', $end)); - return 0; } diff --git a/app/Console/Commands/Upgrade/MigrateToGroups.php b/app/Console/Commands/Upgrade/MigrateToGroups.php index e6ae2caf03..437a28ac81 100644 --- a/app/Console/Commands/Upgrade/MigrateToGroups.php +++ b/app/Console/Commands/Upgrade/MigrateToGroups.php @@ -50,18 +50,8 @@ use Psr\Container\NotFoundExceptionInterface; class MigrateToGroups extends Command { public const CONFIG_NAME = '480_migrated_to_groups'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Migrates a pre-4.7.8 transaction structure to the 4.7.8+ transaction structure.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}'; + protected $signature = 'firefly-iii:migrate-to-groups {--F|force : Force the migration, even if it fired before.}'; private JournalCLIRepositoryInterface $cliRepository; private int $count; private TransactionGroupFactory $groupFactory; @@ -72,17 +62,13 @@ class MigrateToGroups extends Command * Execute the console command. * * @return int - * @throws ContainerExceptionInterface - * @throws FireflyException - * @throws NotFoundExceptionInterface */ public function handle(): int { $this->stupidLaravel(); - $start = microtime(true); if ($this->isMigrated() && true !== $this->option('force')) { - $this->info('Database already seems to be migrated.'); + $this->info('Correct: database is already migrated.'); return 0; } @@ -92,22 +78,14 @@ class MigrateToGroups extends Command } - Log::debug('---- start group migration ----'); $this->makeGroupsFromSplitJournals(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Migrate split journals to groups in %s seconds.', $end)); - - $start = microtime(true); $this->makeGroupsFromAll(); - Log::debug('---- end group migration ----'); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Migrate all journals to groups in %s seconds.', $end)); if (0 !== $this->count) { $this->line(sprintf('Migrated %d transaction journal(s).', $this->count)); } if (0 === $this->count) { - $this->line('No journals to migrate to groups.'); + $this->info('Correct: no journals to migrate to groups.'); } $this->markAsMigrated(); @@ -115,19 +93,122 @@ class MigrateToGroups extends Command } /** - * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is - * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should - * be called from the handle method instead of using the constructor to initialize the command. + * @param TransactionJournal $journal + * @param Transaction $transaction * - + * @return Transaction|null */ - private function stupidLaravel(): void + private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction { - $this->count = 0; - $this->journalRepository = app(JournalRepositoryInterface::class); - $this->service = app(JournalDestroyService::class); - $this->groupFactory = app(TransactionGroupFactory::class); - $this->cliRepository = app(JournalCLIRepositoryInterface::class); + $set = $journal->transactions->filter( + static function (Transaction $subject) use ($transaction) { + $amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float + $identifier = $transaction->identifier === $subject->identifier; + Log::debug(sprintf('Amount the same? %s', var_export($amount, true))); + Log::debug(sprintf('ID the same? %s', var_export($identifier, true))); + + return $amount && $identifier; + } + ); + + return $set->first(); + } + + /** + * @param TransactionJournal $journal + * + * @return Collection + */ + private function getDestinationTransactions(TransactionJournal $journal): Collection + { + return $journal->transactions->filter( + static function (Transaction $transaction) { + return $transaction->amount > 0; + } + ); + } + + /** + * @param Transaction $left + * @param Transaction $right + * + * @return int|null + */ + private function getTransactionBudget(Transaction $left, Transaction $right): ?int + { + Log::debug('Now in getTransactionBudget()'); + + // try to get a budget ID from the left transaction: + /** @var Budget|null $budget */ + $budget = $left->budgets()->first(); + if (null !== $budget) { + Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id)); + + return (int)$budget->id; + } + + // try to get a budget ID from the right transaction: + /** @var Budget|null $budget */ + $budget = $right->budgets()->first(); + if (null !== $budget) { + Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id)); + + return (int)$budget->id; + } + Log::debug('Neither left or right have a budget, return NULL'); + + // if all fails, return NULL. + return null; + } + + /** + * @param Transaction $left + * @param Transaction $right + * + * @return int|null + */ + private function getTransactionCategory(Transaction $left, Transaction $right): ?int + { + Log::debug('Now in getTransactionCategory()'); + + // try to get a category ID from the left transaction: + /** @var Category|null $category */ + $category = $left->categories()->first(); + if (null !== $category) { + Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id)); + + return (int)$category->id; + } + + // try to get a category ID from the left transaction: + /** @var Category|null $category */ + $category = $right->categories()->first(); + if (null !== $category) { + Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id)); + + return (int)$category->id; + } + Log::debug('Neither left or right have a category, return NULL'); + + // if all fails, return NULL. + return null; + } + + /** + * @param array $array + */ + private function giveGroup(array $array): void + { + $groupId = DB::table('transaction_groups')->insertGetId( + [ + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + 'title' => null, + 'user_id' => $array['user_id'], + ] + ); + DB::table('transaction_journals')->where('id', $array['id'])->update(['transaction_group_id' => $groupId]); + $this->count++; } /** @@ -145,6 +226,26 @@ class MigrateToGroups extends Command return false; } + /** + * Gives all journals without a group a group. + */ + private function makeGroupsFromAll(): void + { + $orphanedJournals = $this->cliRepository->getJournalsWithoutGroup(); + $total = count($orphanedJournals); + if ($total > 0) { + Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $total)); + $this->line(sprintf('Going to convert %d transaction journals. Please hold..', $total)); + /** @var array $array */ + foreach ($orphanedJournals as $array) { + $this->giveGroup($array); + } + } + if (0 === $total) { + $this->info('Correct: no need to convert transaction journals.'); + } + } + /** * @throws Exception */ @@ -158,9 +259,6 @@ class MigrateToGroups extends Command $this->makeMultiGroup($journal); } } - if (0 === $splitJournals->count()) { - $this->info('Found no split transaction journals. Nothing to do.'); - } } /** @@ -305,145 +403,6 @@ class MigrateToGroups extends Command ); } - /** - * @param TransactionJournal $journal - * - * @return Collection - */ - private function getDestinationTransactions(TransactionJournal $journal): Collection - { - return $journal->transactions->filter( - static function (Transaction $transaction) { - return $transaction->amount > 0; - } - ); - } - - /** - * @param TransactionJournal $journal - * @param Transaction $transaction - * - * @return Transaction|null - */ - private function findOpposingTransaction(TransactionJournal $journal, Transaction $transaction): ?Transaction - { - $set = $journal->transactions->filter( - static function (Transaction $subject) use ($transaction) { - $amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float - $identifier = $transaction->identifier === $subject->identifier; - Log::debug(sprintf('Amount the same? %s', var_export($amount, true))); - Log::debug(sprintf('ID the same? %s', var_export($identifier, true))); - - return $amount && $identifier; - } - ); - - return $set->first(); - } - - /** - * @param Transaction $left - * @param Transaction $right - * - * @return int|null - */ - private function getTransactionBudget(Transaction $left, Transaction $right): ?int - { - Log::debug('Now in getTransactionBudget()'); - - // try to get a budget ID from the left transaction: - /** @var Budget|null $budget */ - $budget = $left->budgets()->first(); - if (null !== $budget) { - Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id)); - - return (int)$budget->id; - } - - // try to get a budget ID from the right transaction: - /** @var Budget|null $budget */ - $budget = $right->budgets()->first(); - if (null !== $budget) { - Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id)); - - return (int)$budget->id; - } - Log::debug('Neither left or right have a budget, return NULL'); - - // if all fails, return NULL. - return null; - } - - /** - * @param Transaction $left - * @param Transaction $right - * - * @return int|null - */ - private function getTransactionCategory(Transaction $left, Transaction $right): ?int - { - Log::debug('Now in getTransactionCategory()'); - - // try to get a category ID from the left transaction: - /** @var Category|null $category */ - $category = $left->categories()->first(); - if (null !== $category) { - Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id)); - - return (int)$category->id; - } - - // try to get a category ID from the left transaction: - /** @var Category|null $category */ - $category = $right->categories()->first(); - if (null !== $category) { - Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id)); - - return (int)$category->id; - } - Log::debug('Neither left or right have a category, return NULL'); - - // if all fails, return NULL. - return null; - } - - /** - * Gives all journals without a group a group. - */ - private function makeGroupsFromAll(): void - { - $orphanedJournals = $this->cliRepository->getJournalsWithoutGroup(); - $total = count($orphanedJournals); - if ($total > 0) { - Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $total)); - $this->line(sprintf('Going to convert %d transaction journals. Please hold..', $total)); - /** @var array $array */ - foreach ($orphanedJournals as $array) { - $this->giveGroup($array); - } - } - if (0 === $total) { - $this->info('No need to convert transaction journals.'); - } - } - - /** - * @param array $array - */ - private function giveGroup(array $array): void - { - $groupId = DB::table('transaction_groups')->insertGetId( - [ - 'created_at' => date('Y-m-d H:i:s'), - 'updated_at' => date('Y-m-d H:i:s'), - 'title' => null, - 'user_id' => $array['user_id'], - ] - ); - DB::table('transaction_journals')->where('id', $array['id'])->update(['transaction_group_id' => $groupId]); - $this->count++; - } - /** * */ @@ -451,4 +410,20 @@ class MigrateToGroups extends Command { app('fireflyconfig')->set(self::CONFIG_NAME, true); } + + /** + * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is + * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should + * be called from the handle method instead of using the constructor to initialize the command. + * + + */ + private function stupidLaravel(): void + { + $this->count = 0; + $this->journalRepository = app(JournalRepositoryInterface::class); + $this->service = app(JournalDestroyService::class); + $this->groupFactory = app(TransactionGroupFactory::class); + $this->cliRepository = app(JournalCLIRepositoryInterface::class); + } } diff --git a/app/Console/Commands/Upgrade/MigrateToRules.php b/app/Console/Commands/Upgrade/MigrateToRules.php index 79a28c0d03..dbf73a3661 100644 --- a/app/Console/Commands/Upgrade/MigrateToRules.php +++ b/app/Console/Commands/Upgrade/MigrateToRules.php @@ -79,7 +79,7 @@ class MigrateToRules extends Command if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -92,7 +92,7 @@ class MigrateToRules extends Command } if (0 === $this->count) { - $this->line('All bills are OK.'); + $this->info('Correct: all bills are OK.'); } if (0 !== $this->count) { $this->line(sprintf('Verified and fixed %d bill(s).', $this->count)); diff --git a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php index faeb76a83f..77ecf18e2d 100644 --- a/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/OtherCurrenciesCorrections.php @@ -44,18 +44,8 @@ use Psr\Container\NotFoundExceptionInterface; class OtherCurrenciesCorrections extends Command { public const CONFIG_NAME = '480_other_currencies'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Update all journal currency information.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}'; + protected $signature = 'firefly-iii:other-currencies {--F|force : Force the execution of this command.}'; private array $accountCurrencies; private AccountRepositoryInterface $accountRepos; private JournalCLIRepositoryInterface $cliRepos; @@ -74,10 +64,9 @@ class OtherCurrenciesCorrections extends Command public function handle(): int { $this->stupidLaravel(); - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -86,28 +75,78 @@ class OtherCurrenciesCorrections extends Command $this->updateOtherJournalsCurrencies(); $this->markAsExecuted(); - $this->line(sprintf('Verified %d transaction(s) and journal(s).', $this->count)); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified and fixed transaction currencies in %s seconds.', $end)); + $this->info('Correct: verified and fixed transaction currencies.'); return 0; } /** - * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is - * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should - * be called from the handle method instead of using the constructor to initialize the command. + * @param Account $account * - + * @return TransactionCurrency|null */ - private function stupidLaravel(): void + private function getCurrency(Account $account): ?TransactionCurrency { - $this->count = 0; - $this->accountCurrencies = []; - $this->accountRepos = app(AccountRepositoryInterface::class); - $this->currencyRepos = app(CurrencyRepositoryInterface::class); - $this->journalRepos = app(JournalRepositoryInterface::class); - $this->cliRepos = app(JournalCLIRepositoryInterface::class); + $accountId = $account->id; + if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) { + return null; + } + if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) { + return $this->accountCurrencies[$accountId]; + } + $currency = $this->accountRepos->getAccountCurrency($account); + if (null === $currency) { + $this->accountCurrencies[$accountId] = 0; + + return null; + } + $this->accountCurrencies[$accountId] = $currency; + + return $currency; + } + + /** + * Gets the transaction that determines the transaction that "leads" and will determine + * the currency to be used by all transactions, and the journal itself. + * + * @param TransactionJournal $journal + * + * @return Transaction|null + */ + private function getLeadTransaction(TransactionJournal $journal): ?Transaction + { + /** @var Transaction $lead */ + $lead = null; + switch ($journal->transactionType->type) { + default: + break; + case TransactionType::WITHDRAWAL: + $lead = $journal->transactions()->where('amount', '<', 0)->first(); + break; + case TransactionType::DEPOSIT: + $lead = $journal->transactions()->where('amount', '>', 0)->first(); + break; + case TransactionType::OPENING_BALANCE: + // whichever isn't an initial balance account: + $lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin( + 'account_types', + 'accounts.account_type_id', + '=', + 'account_types.id' + )->where('account_types.type', '!=', AccountType::INITIAL_BALANCE)->first(['transactions.*']); + break; + case TransactionType::RECONCILIATION: + // whichever isn't the reconciliation account: + $lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin( + 'account_types', + 'accounts.account_type_id', + '=', + 'account_types.id' + )->where('account_types.type', '!=', AccountType::RECONCILIATION)->first(['transactions.*']); + break; + } + + return $lead; } /** @@ -126,21 +165,28 @@ class OtherCurrenciesCorrections extends Command } /** - * This routine verifies that withdrawals, deposits and opening balances have the correct currency settings for - * the accounts they are linked to. - * Both source and destination must match the respective currency preference of the related asset account. - * So FF3 must verify all transactions. + * */ - private function updateOtherJournalsCurrencies(): void + private function markAsExecuted(): void { - $set = $this->cliRepos->getAllJournals( - [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION,] - ); + app('fireflyconfig')->set(self::CONFIG_NAME, true); + } - /** @var TransactionJournal $journal */ - foreach ($set as $journal) { - $this->updateJournalCurrency($journal); - } + /** + * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is + * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should + * be called from the handle method instead of using the constructor to initialize the command. + * + + */ + private function stupidLaravel(): void + { + $this->count = 0; + $this->accountCurrencies = []; + $this->accountRepos = app(AccountRepositoryInterface::class); + $this->currencyRepos = app(CurrencyRepositoryInterface::class); + $this->journalRepos = app(JournalRepositoryInterface::class); + $this->cliRepos = app(JournalCLIRepositoryInterface::class); } /** @@ -200,79 +246,20 @@ class OtherCurrenciesCorrections extends Command } /** - * Gets the transaction that determines the transaction that "leads" and will determine - * the currency to be used by all transactions, and the journal itself. - * - * @param TransactionJournal $journal - * - * @return Transaction|null + * This routine verifies that withdrawals, deposits and opening balances have the correct currency settings for + * the accounts they are linked to. + * Both source and destination must match the respective currency preference of the related asset account. + * So FF3 must verify all transactions. */ - private function getLeadTransaction(TransactionJournal $journal): ?Transaction + private function updateOtherJournalsCurrencies(): void { - /** @var Transaction $lead */ - $lead = null; - switch ($journal->transactionType->type) { - default: - break; - case TransactionType::WITHDRAWAL: - $lead = $journal->transactions()->where('amount', '<', 0)->first(); - break; - case TransactionType::DEPOSIT: - $lead = $journal->transactions()->where('amount', '>', 0)->first(); - break; - case TransactionType::OPENING_BALANCE: - // whichever isn't an initial balance account: - $lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin( - 'account_types', - 'accounts.account_type_id', - '=', - 'account_types.id' - )->where('account_types.type', '!=', AccountType::INITIAL_BALANCE)->first(['transactions.*']); - break; - case TransactionType::RECONCILIATION: - // whichever isn't the reconciliation account: - $lead = $journal->transactions()->leftJoin('accounts', 'transactions.account_id', '=', 'accounts.id')->leftJoin( - 'account_types', - 'accounts.account_type_id', - '=', - 'account_types.id' - )->where('account_types.type', '!=', AccountType::RECONCILIATION)->first(['transactions.*']); - break; + $set = $this->cliRepos->getAllJournals( + [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::OPENING_BALANCE, TransactionType::RECONCILIATION,] + ); + + /** @var TransactionJournal $journal */ + foreach ($set as $journal) { + $this->updateJournalCurrency($journal); } - - return $lead; - } - - /** - * @param Account $account - * - * @return TransactionCurrency|null - */ - private function getCurrency(Account $account): ?TransactionCurrency - { - $accountId = $account->id; - if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) { - return null; - } - if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) { - return $this->accountCurrencies[$accountId]; - } - $currency = $this->accountRepos->getAccountCurrency($account); - if (null === $currency) { - $this->accountCurrencies[$accountId] = 0; - - return null; - } - $this->accountCurrencies[$accountId] = $currency; - - return $currency; - } - - /** - * - */ - private function markAsExecuted(): void - { - app('fireflyconfig')->set(self::CONFIG_NAME, true); } } diff --git a/app/Console/Commands/Upgrade/RenameAccountMeta.php b/app/Console/Commands/Upgrade/RenameAccountMeta.php index 0d9c5d5e82..b2151f729c 100644 --- a/app/Console/Commands/Upgrade/RenameAccountMeta.php +++ b/app/Console/Commands/Upgrade/RenameAccountMeta.php @@ -58,10 +58,8 @@ class RenameAccountMeta extends Command */ public function handle(): int { - $start = microtime(true); - if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -88,15 +86,12 @@ class RenameAccountMeta extends Command $this->markAsExecuted(); if (0 === $count) { - $this->line('All account meta is OK.'); + $this->info('Correct: all account meta is OK.'); } if (0 !== $count) { $this->line(sprintf('Renamed %d account meta entries (entry).', $count)); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Fixed account meta data in %s seconds.', $end)); - return 0; } diff --git a/app/Console/Commands/Upgrade/TransactionIdentifier.php b/app/Console/Commands/Upgrade/TransactionIdentifier.php index 8eca9098f3..ccebe548bd 100644 --- a/app/Console/Commands/Upgrade/TransactionIdentifier.php +++ b/app/Console/Commands/Upgrade/TransactionIdentifier.php @@ -40,22 +40,10 @@ use Schema; class TransactionIdentifier extends Command { public const CONFIG_NAME = '480_transaction_identifier'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Fixes transaction identifiers.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}'; - /** @var JournalCLIRepositoryInterface */ - private $cliRepository; - /** @var int */ - private $count; + protected $signature = 'firefly-iii:transaction-identifiers {--F|force : Force the execution of this command.}'; + private JournalCLIRepositoryInterface $cliRepository; + private int $count; /** * This method gives all transactions which are part of a split journal (so more than 2) a sort of "order" so they are easier @@ -74,10 +62,9 @@ class TransactionIdentifier extends Command public function handle(): int { $this->stupidLaravel(); - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -94,14 +81,12 @@ class TransactionIdentifier extends Command } if (0 === $this->count) { - $this->line('All split journal transaction identifiers are correct.'); + $this->line('Correct: all split journal transaction identifiers are OK.'); } if (0 !== $this->count) { - $this->line(sprintf('Fixed %d split journal transaction identifier(s).', $this->count)); + $this->line(sprintf('Correct: fixed %d split journal transaction identifier(s).', $this->count)); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified and fixed transaction identifiers in %s seconds.', $end)); $this->markAsExecuted(); return 0; diff --git a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php index 99331d9159..23395e7540 100644 --- a/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php +++ b/app/Console/Commands/Upgrade/TransferCurrenciesCorrections.php @@ -42,18 +42,8 @@ use Psr\Container\NotFoundExceptionInterface; class TransferCurrenciesCorrections extends Command { public const CONFIG_NAME = '480_transfer_currencies'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Updates transfer currency information.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}'; + protected $signature = 'firefly-iii:transfer-currencies {--F|force : Force the execution of this command.}'; private array $accountCurrencies; private AccountRepositoryInterface $accountRepos; private JournalCLIRepositoryInterface $cliRepos; @@ -70,17 +60,13 @@ class TransferCurrenciesCorrections extends Command * Execute the console command. * * @return int - * @throws FireflyException - * @throws ContainerExceptionInterface - * @throws NotFoundExceptionInterface */ public function handle(): int { $this->stupidLaravel(); - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } @@ -90,50 +76,292 @@ class TransferCurrenciesCorrections extends Command $this->markAsExecuted(); if (0 === $this->count) { - $message = 'All transfers have correct currency information.'; - $this->line($message); - Log::debug($message); + $message = 'Correct: all transfers have correct currency information.'; + $this->info($message); } if (0 !== $this->count) { $message = sprintf('Verified currency information of %d transfer(s).', $this->count); $this->line($message); - Log::debug($message); } - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Verified and fixed currency information for transfers in %s seconds.', $end)); - return 0; } /** - * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is - * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should - * be called from the handle method instead of using the constructor to initialize the command. - * - + * The destination transaction must have a currency. If not, it will be added by + * taking it from the destination account's preference. */ - private function stupidLaravel(): void + private function fixDestNoCurrency(): void { - $this->count = 0; - $this->accountRepos = app(AccountRepositoryInterface::class); - $this->cliRepos = app(JournalCLIRepositoryInterface::class); - $this->accountCurrencies = []; - $this->resetInformation(); + if (null === $this->destinationTransaction->transaction_currency_id && null !== $this->destinationCurrency) { + $this->destinationTransaction + ->transaction_currency_id + = (int)$this->destinationCurrency->id; + $message = sprintf( + 'Transaction #%d has no currency setting, now set to %s.', + $this->destinationTransaction->id, + $this->destinationCurrency->code + ); + $this->line($message); + $this->count++; + $this->destinationTransaction->save(); + } } /** - * Reset all the class fields for the current transfer. + * If the foreign amount of the destination transaction is null, but that of the other isn't, use this piece of code + * to restore it. + */ + private function fixDestNullForeignAmount(): void + { + if (null === $this->destinationTransaction->foreign_amount && null !== $this->sourceTransaction->foreign_amount) { + $this->destinationTransaction->foreign_amount = bcmul((string)$this->sourceTransaction->foreign_amount, '-1'); + $this->destinationTransaction->save(); + $this->count++; + $this->line( + sprintf( + 'Restored foreign amount of destination transaction #%d to %s', + $this->destinationTransaction->id, + $this->destinationTransaction->foreign_amount + ) + ); + } + } + + /** + * The destination transaction must have the correct currency. If not, it will be set by + * taking it from the destination account's preference. + */ + private function fixDestinationUnmatchedCurrency(): void + { + if (null !== $this->destinationCurrency + && null === $this->destinationTransaction->foreign_amount + && (int)$this->destinationTransaction->transaction_currency_id !== (int)$this->destinationCurrency->id + ) { + $message = sprintf( + 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', + $this->destinationTransaction->id, + $this->destinationTransaction->transaction_currency_id, + $this->destinationAccount->id, + $this->destinationTransaction->amount + ); + $this->line($message); + $this->count++; + $this->destinationTransaction->transaction_currency_id = (int)$this->destinationCurrency->id; + $this->destinationTransaction->save(); + } + } + + /** + * If the destination account currency is the same as the source currency, + * both foreign_amount and foreign_currency_id fields must be NULL + * for both transactions (because foreign currency info would not make sense) + */ + private function fixInvalidForeignCurrency(): void + { + if ((int)$this->destinationCurrency->id === (int)$this->sourceCurrency->id) { + // update both transactions to match: + $this->sourceTransaction->foreign_amount = null; + $this->sourceTransaction->foreign_currency_id = null; + + $this->destinationTransaction->foreign_amount = null; + $this->destinationTransaction->foreign_currency_id = null; + + $this->sourceTransaction->save(); + $this->destinationTransaction->save(); + } + } + + /** + * If destination account currency is different from source account currency, + * then both transactions must get the source account's currency as normal currency + * and the opposing account's currency as foreign currency. + */ + private function fixMismatchedForeignCurrency(): void + { + if ((int)$this->sourceCurrency->id !== (int)$this->destinationCurrency->id) { + $this->sourceTransaction->transaction_currency_id = $this->sourceCurrency->id; + $this->sourceTransaction->foreign_currency_id = $this->destinationCurrency->id; + $this->destinationTransaction->transaction_currency_id = $this->sourceCurrency->id; + $this->destinationTransaction->foreign_currency_id = $this->destinationCurrency->id; + + $this->sourceTransaction->save(); + $this->destinationTransaction->save(); + $this->count++; + $this->line(sprintf('Verified foreign currency ID of transaction #%d and #%d', $this->sourceTransaction->id, $this->destinationTransaction->id)); + } + } + + /** + * The source transaction must have a currency. If not, it will be added by + * taking it from the source account's preference. + */ + private function fixSourceNoCurrency(): void + { + if (null === $this->sourceTransaction->transaction_currency_id && null !== $this->sourceCurrency) { + $this->sourceTransaction + ->transaction_currency_id + = (int)$this->sourceCurrency->id; + $message = sprintf( + 'Transaction #%d has no currency setting, now set to %s.', + $this->sourceTransaction->id, + $this->sourceCurrency->code + ); + $this->line($message); + $this->count++; + $this->sourceTransaction->save(); + } + } + + /** + * If the foreign amount of the source transaction is null, but that of the other isn't, use this piece of code + * to restore it. + */ + private function fixSourceNullForeignAmount(): void + { + if (null === $this->sourceTransaction->foreign_amount && null !== $this->destinationTransaction->foreign_amount) { + $this->sourceTransaction->foreign_amount = bcmul((string)$this->destinationTransaction->foreign_amount, '-1'); + $this->sourceTransaction->save(); + $this->count++; + $this->line( + sprintf( + 'Restored foreign amount of source transaction #%d to %s', + $this->sourceTransaction->id, + $this->sourceTransaction->foreign_amount + ) + ); + } + } + + /** + * The source transaction must have the correct currency. If not, it will be set by + * taking it from the source account's preference. + */ + private function fixSourceUnmatchedCurrency(): void + { + if (null !== $this->sourceCurrency + && null === $this->sourceTransaction->foreign_amount + && (int)$this->sourceTransaction->transaction_currency_id !== (int)$this->sourceCurrency->id + ) { + $message = sprintf( + 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', + $this->sourceTransaction->id, + $this->sourceTransaction->transaction_currency_id, + $this->sourceAccount->id, + $this->sourceTransaction->amount + ); + $this->line($message); + $this->count++; + $this->sourceTransaction->transaction_currency_id = (int)$this->sourceCurrency->id; + $this->sourceTransaction->save(); + } + } + + /** + * This method makes sure that the transaction journal uses the currency given in the source transaction. + * + * @param TransactionJournal $journal + */ + private function fixTransactionJournalCurrency(TransactionJournal $journal): void + { + if ((int)$journal->transaction_currency_id !== (int)$this->sourceCurrency->id) { + $oldCurrencyCode = $journal->transactionCurrency->code ?? '(nothing)'; + $journal->transaction_currency_id = $this->sourceCurrency->id; + $message = sprintf( + 'Transfer #%d ("%s") has been updated to use %s instead of %s.', + $journal->id, + $journal->description, + $this->sourceCurrency->code, + $oldCurrencyCode + ); + $this->count++; + $this->line($message); + $journal->save(); + } + } + + /** + * @param Account $account + * + * @return TransactionCurrency|null + */ + private function getCurrency(Account $account): ?TransactionCurrency + { + $accountId = $account->id; + if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) { + return null; + } + if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) { + return $this->accountCurrencies[$accountId]; + } + $currency = $this->accountRepos->getAccountCurrency($account); + if (null === $currency) { + $this->accountCurrencies[$accountId] = 0; + + return null; + } + $this->accountCurrencies[$accountId] = $currency; + + return $currency; + } + + /** + * Extract destination transaction, destination account + destination account currency from the journal. + * + * @param TransactionJournal $journal * */ - private function resetInformation(): void + private function getDestinationInformation(TransactionJournal $journal): void { - $this->sourceTransaction = null; - $this->sourceAccount = null; - $this->sourceCurrency = null; - $this->destinationTransaction = null; - $this->destinationAccount = null; - $this->destinationCurrency = null; + $this->destinationTransaction = $this->getDestinationTransaction($journal); + $this->destinationAccount = $this->destinationTransaction?->account; + $this->destinationCurrency = null === $this->destinationAccount ? null : $this->getCurrency($this->destinationAccount); + } + + /** + * @param TransactionJournal $transfer + * + * @return Transaction|null + */ + private function getDestinationTransaction(TransactionJournal $transfer): ?Transaction + { + return $transfer->transactions()->where('amount', '>', 0)->first(); + } + + /** + * Extract source transaction, source account + source account currency from the journal. + * + * @param TransactionJournal $journal + * + + */ + private function getSourceInformation(TransactionJournal $journal): void + { + $this->sourceTransaction = $this->getSourceTransaction($journal); + $this->sourceAccount = $this->sourceTransaction?->account; + $this->sourceCurrency = null === $this->sourceAccount ? null : $this->getCurrency($this->sourceAccount); + } + + /** + * @param TransactionJournal $transfer + * + * @return Transaction|null + */ + private function getSourceTransaction(TransactionJournal $transfer): ?Transaction + { + return $transfer->transactions()->where('amount', '<', 0)->first(); + } + + /** + * Is either the source or destination transaction NULL? + * + * @return bool + */ + private function isEmptyTransactions(): bool + { + return null === $this->sourceTransaction || null === $this->destinationTransaction + || null === $this->sourceAccount + || null === $this->destinationAccount; } /** @@ -151,6 +379,71 @@ class TransferCurrenciesCorrections extends Command return false; } + /** + * @return bool + */ + private function isNoCurrencyPresent(): bool + { + // source account must have a currency preference. + if (null === $this->sourceCurrency) { + $message = sprintf('Account #%d ("%s") must have currency preference but has none.', $this->sourceAccount->id, $this->sourceAccount->name); + Log::error($message); + $this->error($message); + + return true; + } + + // destination account must have a currency preference. + if (null === $this->destinationCurrency) { + $message = sprintf( + 'Account #%d ("%s") must have currency preference but has none.', + $this->destinationAccount->id, + $this->destinationAccount->name + ); + Log::error($message); + $this->error($message); + + return true; + } + + return false; + } + + /** + * Is this a split transaction journal? + * + * @param TransactionJournal $transfer + * + * @return bool + */ + private function isSplitJournal(TransactionJournal $transfer): bool + { + return $transfer->transactions->count() > 2; + } + + /** + * + */ + private function markAsExecuted(): void + { + app('fireflyconfig')->set(self::CONFIG_NAME, true); + } + + /** + * Reset all the class fields for the current transfer. + * + + */ + private function resetInformation(): void + { + $this->sourceTransaction = null; + $this->sourceAccount = null; + $this->sourceCurrency = null; + $this->destinationTransaction = null; + $this->destinationAccount = null; + $this->destinationCurrency = null; + } + /** * This routine verifies that transfers have the correct currency settings for the accounts they are linked to. * For transfers, this is can be a destructive routine since we FORCE them into a currency setting whether they @@ -168,6 +461,22 @@ class TransferCurrenciesCorrections extends Command } } + /** + * Laravel will execute ALL __construct() methods for ALL commands whenever a SINGLE command is + * executed. This leads to noticeable slow-downs and class calls. To prevent this, this method should + * be called from the handle method instead of using the constructor to initialize the command. + * + + */ + private function stupidLaravel(): void + { + $this->count = 0; + $this->accountRepos = app(AccountRepositoryInterface::class); + $this->cliRepos = app(JournalCLIRepositoryInterface::class); + $this->accountCurrencies = []; + $this->resetInformation(); + } + /** * @param TransactionJournal $transfer */ @@ -230,351 +539,4 @@ class TransferCurrenciesCorrections extends Command // fix journal itself: $this->fixTransactionJournalCurrency($transfer); } - - /** - * Is this a split transaction journal? - * - * @param TransactionJournal $transfer - * - * @return bool - */ - private function isSplitJournal(TransactionJournal $transfer): bool - { - return $transfer->transactions->count() > 2; - } - - /** - * Extract source transaction, source account + source account currency from the journal. - * - * @param TransactionJournal $journal - * - - */ - private function getSourceInformation(TransactionJournal $journal): void - { - $this->sourceTransaction = $this->getSourceTransaction($journal); - $this->sourceAccount = $this->sourceTransaction?->account; - $this->sourceCurrency = null === $this->sourceAccount ? null : $this->getCurrency($this->sourceAccount); - } - - /** - * @param TransactionJournal $transfer - * - * @return Transaction|null - */ - private function getSourceTransaction(TransactionJournal $transfer): ?Transaction - { - return $transfer->transactions()->where('amount', '<', 0)->first(); - } - - /** - * @param Account $account - * - * @return TransactionCurrency|null - */ - private function getCurrency(Account $account): ?TransactionCurrency - { - $accountId = $account->id; - if (array_key_exists($accountId, $this->accountCurrencies) && 0 === $this->accountCurrencies[$accountId]) { - return null; - } - if (array_key_exists($accountId, $this->accountCurrencies) && $this->accountCurrencies[$accountId] instanceof TransactionCurrency) { - return $this->accountCurrencies[$accountId]; - } - $currency = $this->accountRepos->getAccountCurrency($account); - if (null === $currency) { - $this->accountCurrencies[$accountId] = 0; - - return null; - } - $this->accountCurrencies[$accountId] = $currency; - - return $currency; - } - - /** - * Extract destination transaction, destination account + destination account currency from the journal. - * - * @param TransactionJournal $journal - * - - */ - private function getDestinationInformation(TransactionJournal $journal): void - { - $this->destinationTransaction = $this->getDestinationTransaction($journal); - $this->destinationAccount = $this->destinationTransaction?->account; - $this->destinationCurrency = null === $this->destinationAccount ? null : $this->getCurrency($this->destinationAccount); - } - - /** - * @param TransactionJournal $transfer - * - * @return Transaction|null - */ - private function getDestinationTransaction(TransactionJournal $transfer): ?Transaction - { - return $transfer->transactions()->where('amount', '>', 0)->first(); - } - - /** - * Is either the source or destination transaction NULL? - * - * @return bool - */ - private function isEmptyTransactions(): bool - { - return null === $this->sourceTransaction || null === $this->destinationTransaction - || null === $this->sourceAccount - || null === $this->destinationAccount; - } - - /** - * @return bool - */ - private function isNoCurrencyPresent(): bool - { - // source account must have a currency preference. - if (null === $this->sourceCurrency) { - $message = sprintf('Account #%d ("%s") must have currency preference but has none.', $this->sourceAccount->id, $this->sourceAccount->name); - Log::error($message); - $this->error($message); - - return true; - } - - // destination account must have a currency preference. - if (null === $this->destinationCurrency) { - $message = sprintf( - 'Account #%d ("%s") must have currency preference but has none.', - $this->destinationAccount->id, - $this->destinationAccount->name - ); - Log::error($message); - $this->error($message); - - return true; - } - - return false; - } - - /** - * The source transaction must have a currency. If not, it will be added by - * taking it from the source account's preference. - */ - private function fixSourceNoCurrency(): void - { - if (null === $this->sourceTransaction->transaction_currency_id && null !== $this->sourceCurrency) { - $this->sourceTransaction - ->transaction_currency_id - = (int)$this->sourceCurrency->id; - $message = sprintf( - 'Transaction #%d has no currency setting, now set to %s.', - $this->sourceTransaction->id, - $this->sourceCurrency->code - ); - Log::debug($message); - $this->line($message); - $this->count++; - $this->sourceTransaction->save(); - } - } - - /** - * The source transaction must have the correct currency. If not, it will be set by - * taking it from the source account's preference. - */ - private function fixSourceUnmatchedCurrency(): void - { - if (null !== $this->sourceCurrency - && null === $this->sourceTransaction->foreign_amount - && (int)$this->sourceTransaction->transaction_currency_id !== (int)$this->sourceCurrency->id - ) { - $message = sprintf( - 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', - $this->sourceTransaction->id, - $this->sourceTransaction->transaction_currency_id, - $this->sourceAccount->id, - $this->sourceTransaction->amount - ); - Log::debug($message); - $this->line($message); - $this->count++; - $this->sourceTransaction->transaction_currency_id = (int)$this->sourceCurrency->id; - $this->sourceTransaction->save(); - } - } - - /** - * The destination transaction must have a currency. If not, it will be added by - * taking it from the destination account's preference. - */ - private function fixDestNoCurrency(): void - { - if (null === $this->destinationTransaction->transaction_currency_id && null !== $this->destinationCurrency) { - $this->destinationTransaction - ->transaction_currency_id - = (int)$this->destinationCurrency->id; - $message = sprintf( - 'Transaction #%d has no currency setting, now set to %s.', - $this->destinationTransaction->id, - $this->destinationCurrency->code - ); - Log::debug($message); - $this->line($message); - $this->count++; - $this->destinationTransaction->save(); - } - } - - /** - * The destination transaction must have the correct currency. If not, it will be set by - * taking it from the destination account's preference. - */ - private function fixDestinationUnmatchedCurrency(): void - { - if (null !== $this->destinationCurrency - && null === $this->destinationTransaction->foreign_amount - && (int)$this->destinationTransaction->transaction_currency_id !== (int)$this->destinationCurrency->id - ) { - $message = sprintf( - 'Transaction #%d has a currency setting #%d that should be #%d. Amount remains %s, currency is changed.', - $this->destinationTransaction->id, - $this->destinationTransaction->transaction_currency_id, - $this->destinationAccount->id, - $this->destinationTransaction->amount - ); - Log::debug($message); - $this->line($message); - $this->count++; - $this->destinationTransaction->transaction_currency_id = (int)$this->destinationCurrency->id; - $this->destinationTransaction->save(); - } - } - - /** - * If the destination account currency is the same as the source currency, - * both foreign_amount and foreign_currency_id fields must be NULL - * for both transactions (because foreign currency info would not make sense) - */ - private function fixInvalidForeignCurrency(): void - { - if ((int)$this->destinationCurrency->id === (int)$this->sourceCurrency->id) { - // update both transactions to match: - $this->sourceTransaction->foreign_amount = null; - $this->sourceTransaction->foreign_currency_id = null; - - $this->destinationTransaction->foreign_amount = null; - $this->destinationTransaction->foreign_currency_id = null; - - $this->sourceTransaction->save(); - $this->destinationTransaction->save(); - - Log::debug( - sprintf( - 'Currency for account "%s" is %s, and currency for account "%s" is also - %s, so transactions #%d and #%d has been verified to be to %s exclusively.', - $this->destinationAccount->name, - $this->destinationCurrency->code, - $this->sourceAccount->name, - $this->sourceCurrency->code, - $this->sourceTransaction->id, - $this->destinationTransaction->id, - $this->sourceCurrency->code - ) - ); - } - } - - /** - * If destination account currency is different from source account currency, - * then both transactions must get the source account's currency as normal currency - * and the opposing account's currency as foreign currency. - */ - private function fixMismatchedForeignCurrency(): void - { - if ((int)$this->sourceCurrency->id !== (int)$this->destinationCurrency->id) { - $this->sourceTransaction->transaction_currency_id = $this->sourceCurrency->id; - $this->sourceTransaction->foreign_currency_id = $this->destinationCurrency->id; - $this->destinationTransaction->transaction_currency_id = $this->sourceCurrency->id; - $this->destinationTransaction->foreign_currency_id = $this->destinationCurrency->id; - - $this->sourceTransaction->save(); - $this->destinationTransaction->save(); - $this->count++; - Log::debug(sprintf('Verified foreign currency ID of transaction #%d and #%d', $this->sourceTransaction->id, $this->destinationTransaction->id)); - } - } - - /** - * If the foreign amount of the source transaction is null, but that of the other isn't, use this piece of code - * to restore it. - */ - private function fixSourceNullForeignAmount(): void - { - if (null === $this->sourceTransaction->foreign_amount && null !== $this->destinationTransaction->foreign_amount) { - $this->sourceTransaction->foreign_amount = bcmul((string)$this->destinationTransaction->foreign_amount, '-1'); - $this->sourceTransaction->save(); - $this->count++; - Log::debug( - sprintf( - 'Restored foreign amount of source transaction #%d to %s', - $this->sourceTransaction->id, - $this->sourceTransaction->foreign_amount - ) - ); - } - } - - /** - * If the foreign amount of the destination transaction is null, but that of the other isn't, use this piece of code - * to restore it. - */ - private function fixDestNullForeignAmount(): void - { - if (null === $this->destinationTransaction->foreign_amount && null !== $this->sourceTransaction->foreign_amount) { - $this->destinationTransaction->foreign_amount = bcmul((string)$this->sourceTransaction->foreign_amount, '-1'); - $this->destinationTransaction->save(); - $this->count++; - Log::debug( - sprintf( - 'Restored foreign amount of destination transaction #%d to %s', - $this->destinationTransaction->id, - $this->destinationTransaction->foreign_amount - ) - ); - } - } - - /** - * This method makes sure that the transaction journal uses the currency given in the source transaction. - * - * @param TransactionJournal $journal - */ - private function fixTransactionJournalCurrency(TransactionJournal $journal): void - { - if ((int)$journal->transaction_currency_id !== (int)$this->sourceCurrency->id) { - $oldCurrencyCode = $journal->transactionCurrency->code ?? '(nothing)'; - $journal->transaction_currency_id = $this->sourceCurrency->id; - $message = sprintf( - 'Transfer #%d ("%s") has been updated to use %s instead of %s.', - $journal->id, - $journal->description, - $this->sourceCurrency->code, - $oldCurrencyCode - ); - $this->count++; - $this->line($message); - Log::debug($message); - $journal->save(); - } - } - - /** - * - */ - private function markAsExecuted(): void - { - app('fireflyconfig')->set(self::CONFIG_NAME, true); - } } diff --git a/app/Console/Commands/Upgrade/UpgradeDatabase.php b/app/Console/Commands/Upgrade/UpgradeDatabase.php index 09ea26f05e..17ca07a0ed 100644 --- a/app/Console/Commands/Upgrade/UpgradeDatabase.php +++ b/app/Console/Commands/Upgrade/UpgradeDatabase.php @@ -35,18 +35,8 @@ use Illuminate\Console\Command; */ class UpgradeDatabase extends Command { - /** - * The console command description. - * - * @var string - */ protected $description = 'Upgrades the database to the latest version.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:upgrade-database {--F|force : Force all upgrades.}'; + protected $signature = 'firefly-iii:upgrade-database {--F|force : Force all upgrades.}'; /** * Execute the console command. @@ -97,15 +87,8 @@ class UpgradeDatabase extends Command */ private function callInitialCommands(): void { - $this->line('Now seeding the database...'); $this->call('migrate', ['--seed' => true, '--force' => true, '--no-interaction' => true]); - - $this->line('Fix PostgreSQL sequences.'); $this->call('firefly-iii:fix-pgsql-sequences'); - - $this->line('Now decrypting the database (if necessary)...'); $this->call('firefly-iii:decrypt-all'); - - $this->line('Done!'); } } diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilities.php b/app/Console/Commands/Upgrade/UpgradeLiabilities.php index 7e93c7f44d..1d6b8f6134 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilities.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilities.php @@ -43,18 +43,8 @@ use Psr\Container\NotFoundExceptionInterface; class UpgradeLiabilities extends Command { public const CONFIG_NAME = '560_upgrade_liabilities'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Upgrade liabilities to new 5.6.0 structure.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}'; + protected $signature = 'firefly-iii:upgrade-liabilities {--F|force : Force the execution of this command.}'; /** * Execute the console command. @@ -66,7 +56,6 @@ class UpgradeLiabilities extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { $this->warn('This command has already been executed.'); @@ -75,10 +64,6 @@ class UpgradeLiabilities extends Command $this->upgradeLiabilities(); $this->markAsExecuted(); - - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Upgraded liabilities in %s seconds.', $end)); - return 0; } @@ -95,15 +80,12 @@ class UpgradeLiabilities extends Command } // source MUST be the liability. if ((int)$destination->account_id === (int)$account->id) { - Log::debug(sprintf('Must switch around, because account #%d is the destination.', $destination->account_id)); // so if not, switch things around: $sourceAccountId = (int)$source->account_id; $source->account_id = $destination->account_id; $destination->account_id = $sourceAccountId; $source->save(); $destination->save(); - Log::debug(sprintf('Source transaction #%d now has account #%d', $source->id, $source->account_id)); - Log::debug(sprintf('Dest transaction #%d now has account #%d', $destination->id, $destination->account_id)); } } @@ -155,7 +137,6 @@ class UpgradeLiabilities extends Command */ private function upgradeForUser(User $user): void { - Log::debug(sprintf('Upgrading liabilities for user #%d', $user->id)); $accounts = $user->accounts() ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') ->whereIn('account_types.type', config('firefly.valid_liabilities')) @@ -174,7 +155,6 @@ class UpgradeLiabilities extends Command */ private function upgradeLiabilities(): void { - Log::debug('Upgrading liabilities.'); $users = User::get(); /** @var User $user */ foreach ($users as $user) { @@ -190,7 +170,6 @@ class UpgradeLiabilities extends Command /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $repository->setUser($account->user); - Log::debug(sprintf('Upgrade liability #%d', $account->id)); // get opening balance, and correct if necessary. $openingBalance = $repository->getOpeningBalance($account); diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php index 7acb7df97b..f1d1037458 100644 --- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php +++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php @@ -45,18 +45,8 @@ use Psr\Container\NotFoundExceptionInterface; class UpgradeLiabilitiesEight extends Command { public const CONFIG_NAME = '600_upgrade_liabilities'; - /** - * The console command description. - * - * @var string - */ protected $description = 'Upgrade liabilities to new 6.0.0 structure.'; - /** - * The name and signature of the console command. - * - * @var string - */ - protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}'; + protected $signature = 'firefly-iii:liabilities-600 {--F|force : Force the execution of this command.}'; /** * Execute the console command. @@ -68,7 +58,6 @@ class UpgradeLiabilitiesEight extends Command */ public function handle(): int { - $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { $this->warn('This command has already been executed.'); @@ -77,9 +66,6 @@ class UpgradeLiabilitiesEight extends Command $this->upgradeLiabilities(); $this->markAsExecuted(); - $end = round(microtime(true) - $start, 2); - $this->info(sprintf('Upgraded liabilities for 6.0.0 in %s seconds.', $end)); - return 0; } @@ -90,7 +76,6 @@ class UpgradeLiabilitiesEight extends Command */ private function deleteCreditTransaction(Account $account): void { - Log::debug('Will delete credit transaction.'); $liabilityType = TransactionType::whereType(TransactionType::LIABILITY_CREDIT)->first(); $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') ->where('transactions.account_id', $account->id) @@ -100,11 +85,9 @@ class UpgradeLiabilitiesEight extends Command $group = $liabilityJournal->transactionGroup; $service = new TransactionGroupDestroyService(); $service->destroy($group); - Log::debug(sprintf('Deleted liability credit group #%d', $group->id)); return; } - Log::debug('No liability credit journal found.'); } /** @@ -117,7 +100,6 @@ class UpgradeLiabilitiesEight extends Command $count = 0; $journals = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') ->where('transactions.account_id', $account->id)->get(['transaction_journals.*']); - Log::debug(sprintf('Found %d journals to analyse.', $journals->count())); /** @var TransactionJournal $journal */ foreach ($journals as $journal) { $delete = false; @@ -140,16 +122,6 @@ class UpgradeLiabilitiesEight extends Command $delete = false; if ($delete) { - Log::debug( - sprintf( - 'Deleted %s journal #%d ("%s") (%s %s).', - $journal->transactionType->type, - $journal->id, - $journal->description, - $journal->transactionCurrency->code, - $dest->amount - ) - ); $service = app(TransactionGroupDestroyService::class); $service->destroy($journal->transactionGroup); $count++; @@ -173,8 +145,6 @@ class UpgradeLiabilitiesEight extends Command ->where('transaction_journals.transaction_type_id', $openingBalanceType->id) ->first(['transaction_journals.*']); if (null === $openingJournal) { - Log::debug('Account has no opening balance and can be skipped.'); - return false; } $liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id') @@ -182,16 +152,11 @@ class UpgradeLiabilitiesEight extends Command ->where('transaction_journals.transaction_type_id', $liabilityType->id) ->first(['transaction_journals.*']); if (null === $liabilityJournal) { - Log::debug('Account has no liability credit and can be skipped.'); - return false; } if (!$openingJournal->date->isSameDay($liabilityJournal->date)) { - Log::debug('Account has opening/credit not on the same day.'); - return false; } - Log::debug('Account has bad opening balance data.'); return true; } @@ -243,7 +208,6 @@ class UpgradeLiabilitiesEight extends Command $source->account_id = $destId; $source->save(); $dest->save(); - Log::debug(sprintf('Opening balance transaction journal #%d reversed.', $openingJournal->id)); return; } @@ -255,7 +219,6 @@ class UpgradeLiabilitiesEight extends Command */ private function upgradeForUser(User $user): void { - Log::debug(sprintf('Upgrading liabilities for user #%d', $user->id)); $accounts = $user->accounts() ->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id') ->whereIn('account_types.type', config('firefly.valid_liabilities')) @@ -274,7 +237,6 @@ class UpgradeLiabilitiesEight extends Command */ private function upgradeLiabilities(): void { - Log::debug('Upgrading liabilities.'); $users = User::get(); /** @var User $user */ foreach ($users as $user) { @@ -287,16 +249,11 @@ class UpgradeLiabilitiesEight extends Command */ private function upgradeLiability(Account $account): void { - Log::debug(sprintf('Upgrade liability #%d ("%s")', $account->id, $account->name)); - /** @var AccountRepositoryInterface $repository */ $repository = app(AccountRepositoryInterface::class); $repository->setUser($account->user); $direction = $repository->getMetaValue($account, 'liability_direction'); - if ('debit' === $direction) { - Log::debug('Direction is debit ("I owe this amount"), so no need to upgrade.'); - } if ('credit' === $direction && $this->hasBadOpening($account)) { $this->deleteCreditTransaction($account); $this->reverseOpeningBalance($account); @@ -308,6 +265,5 @@ class UpgradeLiabilitiesEight extends Command $this->line(sprintf('Removed %d old format transaction(s) for liability #%d ("%s")', $count, $account->id, $account->name)); } } - Log::debug(sprintf('Done upgrading liability #%d ("%s")', $account->id, $account->name)); } } diff --git a/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub b/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub index 90c0009222..c11ba2c00e 100644 --- a/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub +++ b/app/Console/Commands/Upgrade/UpgradeSkeleton.php.stub @@ -33,7 +33,7 @@ class UpgradeSkeleton extends Command { $start = microtime(true); if ($this->isExecuted() && true !== $this->option('force')) { - $this->warn('This command has already been executed.'); + $this->warn('Correct: this command has already been executed.'); return 0; } diff --git a/app/Factory/AccountMetaFactory.php b/app/Factory/AccountMetaFactory.php index 3977153c89..a5d4031098 100644 --- a/app/Factory/AccountMetaFactory.php +++ b/app/Factory/AccountMetaFactory.php @@ -60,15 +60,12 @@ class AccountMetaFactory if ('' !== $value) { // if $data has field and $entry is null, create new one: if (null === $entry) { - Log::debug(sprintf('Created meta-field "%s":"%s" for account #%d ("%s") ', $field, $value, $account->id, $account->name)); - return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]); } // if $data has field and $entry is not null, update $entry: $entry->data = $value; $entry->save(); - Log::debug(sprintf('Updated meta-field "%s":"%s" for #%d ("%s") ', $field, $value, $account->id, $account->name)); } if ('' === $value && null !== $entry) { $entry->delete(); diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.php index 995bc1fe1a..d52b983021 100644 --- a/app/Http/Controllers/DebugController.php +++ b/app/Http/Controllers/DebugController.php @@ -102,7 +102,6 @@ class DebugController extends Controller Log::debug('Call view:clear...'); Artisan::call('view:clear'); - Log::debug('Done! Redirecting...'); return redirect(route('index')); } diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php index 6853c9194c..92ad6f9aa5 100644 --- a/app/Repositories/Account/AccountRepository.php +++ b/app/Repositories/Account/AccountRepository.php @@ -667,7 +667,6 @@ class AccountRepository implements AccountRepositoryInterface //[AccountType::CASH, AccountType::INITIAL_BALANCE, AccountType::IMPORT, AccountType::RECONCILIATION], ]; foreach ($sets as $set) { - Log::debug('Now in resetAccountOrder', $set); $list = $this->getAccountsByType($set); $index = 1; foreach ($list as $account) { diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.php index a22b3593c9..53a5360b8e 100644 --- a/app/Services/Internal/Support/CreditRecalculateService.php +++ b/app/Services/Internal/Support/CreditRecalculateService.php @@ -57,25 +57,18 @@ class CreditRecalculateService public function recalculate(): void { if (true !== config('firefly.feature_flags.handle_debts')) { - Log::debug('handle_debts is disabled.'); - return; } if (null !== $this->group && null === $this->account) { - Log::debug('Have to handle a group.'); $this->processGroup(); } if (null !== $this->account && null === $this->group) { - Log::debug('Have to handle an account.'); // work based on account. $this->processAccount(); } if (0 === count($this->work)) { - Log::debug('No work accounts, do not do CreditRecalculationService'); - return; } - Log::debug('Will now do CreditRecalculationService'); $this->processWork(); } @@ -108,11 +101,9 @@ class CreditRecalculateService // destination or source must be liability. $valid = config('firefly.valid_liabilities'); if (in_array($destination->accountType->type, $valid, true)) { - Log::debug(sprintf('Dest account type is "%s", include it.', $destination->accountType->type)); $this->work[] = $destination; } if (in_array($source->accountType->type, $valid, true)) { - Log::debug(sprintf('Src account type is "%s", include it.', $source->accountType->type)); $this->work[] = $source; } } @@ -168,7 +159,6 @@ class CreditRecalculateService { $valid = config('firefly.valid_liabilities'); if (in_array($this->account->accountType->type, $valid, true)) { - Log::debug(sprintf('Account type is "%s", include it.', $this->account->accountType->type)); $this->work[] = $this->account; } } @@ -187,7 +177,6 @@ class CreditRecalculateService Log::error(sprintf('Could not find work account for transaction group #%d.', $this->group->id)); } } - Log::debug(sprintf('Done with %s', __METHOD__)); } /** @@ -200,7 +189,6 @@ class CreditRecalculateService */ private function processTransaction(Account $account, string $direction, Transaction $transaction, string $leftOfDebt): string { - Log::debug(sprintf('Now in processTransaction(#%d, %s)', $transaction->id, $leftOfDebt)); $journal = $transaction->transactionJournal; $foreignCurrency = $transaction->foreignCurrency; $accountCurrency = $this->repository->getAccountCurrency($account); @@ -212,12 +200,9 @@ class CreditRecalculateService $sourceTransaction = $journal->transactions()->where('amount', '<', '0')->first(); if ('' === $direction) { - Log::debug('Since direction is "", do nothing.'); - return $leftOfDebt; } if (TransactionType::LIABILITY_CREDIT === $type || TransactionType::OPENING_BALANCE === $type) { - Log::debug(sprintf('Skip group #%d, journal #%d of type "%s"', $journal->id, $groupId, $type)); return $leftOfDebt; } @@ -225,11 +210,8 @@ class CreditRecalculateService $usedAmount = $transaction->amount; if (null !== $foreignCurrency && $foreignCurrency->id === $accountCurrency->id) { $usedAmount = $transaction->foreign_amount; - Log::debug('Will use foreign amount to match account currency.'); } - Log::debug(sprintf('Processing group #%d, journal #%d of type "%s"', $journal->id, $groupId, $type)); - // Case 1 // it's a withdrawal into this liability (from asset). // if it's a credit ("I am owed"), this increases the amount due, @@ -240,9 +222,7 @@ class CreditRecalculateService && 1 === bccomp($usedAmount, '0') && 'credit' === $direction ) { - $newLeftOfDebt = bcadd($leftOfDebt, app('steam')->positive($usedAmount)); - Log::debug(sprintf('[1] Is withdrawal (%s) into liability, left of debt = %s.', $usedAmount, $newLeftOfDebt)); - return $newLeftOfDebt; + return bcadd($leftOfDebt, app('steam')->positive($usedAmount)); } // Case 2 @@ -255,15 +235,7 @@ class CreditRecalculateService && -1 === bccomp($usedAmount, '0') && 'credit' === $direction ) { - $newLeftOfDebt = bcsub($leftOfDebt, app('steam')->positive($usedAmount)); - Log::debug( - sprintf( - '[2] Is withdrawal (%s) away from liability, left of debt = %s.', - $usedAmount, - $newLeftOfDebt - ) - ); - return $newLeftOfDebt; + return bcsub($leftOfDebt, app('steam')->positive($usedAmount)); } // case 3 @@ -276,9 +248,7 @@ class CreditRecalculateService && -1 === bccomp($usedAmount, '0') && 'credit' === $direction ) { - $newLeftOfDebt = bcsub($leftOfDebt, app('steam')->positive($usedAmount)); - Log::debug(sprintf('[3] Is deposit (%s) away from liability, left of debt = %s.', $usedAmount, $newLeftOfDebt)); - return $newLeftOfDebt; + return bcsub($leftOfDebt, app('steam')->positive($usedAmount)); } // case 4 @@ -292,16 +262,12 @@ class CreditRecalculateService && 'credit' === $direction ) { $newLeftOfDebt = bcadd($leftOfDebt, app('steam')->positive($usedAmount)); - Log::debug(sprintf('[4] Is deposit (%s) into liability, left of debt = %s.', $usedAmount, $newLeftOfDebt)); return $newLeftOfDebt; } // in any other case, remove amount from left of debt. if (in_array($type, [TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER], true)) { $newLeftOfDebt = bcadd($leftOfDebt, bcmul($usedAmount, '-1')); - Log::debug( - sprintf('[5] Fallback: transaction is withdrawal/deposit/transfer, remove amount %s from left of debt, = %s.', $usedAmount, $newLeftOfDebt) - ); return $newLeftOfDebt; } @@ -319,7 +285,6 @@ class CreditRecalculateService foreach ($this->work as $account) { $this->processWorkAccount($account); } - Log::debug(sprintf('Done with %s', __METHOD__)); } /** @@ -327,8 +292,6 @@ class CreditRecalculateService */ private function processWorkAccount(Account $account): void { - Log::debug(sprintf('Now in %s(#%d)', __METHOD__, $account->id)); - // get opening balance (if present) $this->repository->setUser($account->user); $startOfDebt = $this->repository->getOpeningBalanceAmount($account) ?? '0'; @@ -345,14 +308,10 @@ class CreditRecalculateService // now loop all transactions (except opening balance and credit thing) $transactions = $account->transactions()->get(); - Log::debug(sprintf('Going to process %d transaction(s)', $transactions->count())); - Log::debug(sprintf('Account currency is #%d (%s)', $account->id, $this->repository->getAccountCurrency($account)?->code)); /** @var Transaction $transaction */ foreach ($transactions as $transaction) { $leftOfDebt = $this->processTransaction($account, $direction, $transaction, $leftOfDebt); } $factory->crud($account, 'current_debt', $leftOfDebt); - - Log::debug(sprintf('Done with %s(#%d)', __METHOD__, $account->id)); } } diff --git a/app/Services/Internal/Support/JournalServiceTrait.php b/app/Services/Internal/Support/JournalServiceTrait.php index 5cafba52cc..cedbbfcf93 100644 --- a/app/Services/Internal/Support/JournalServiceTrait.php +++ b/app/Services/Internal/Support/JournalServiceTrait.php @@ -265,7 +265,6 @@ trait JournalServiceTrait Log::debug('End of loop.'); Log::debug(sprintf('Total nr. of tags: %d', count($tags)), $tags); $journal->tags()->sync($set); - Log::debug('Done!'); } /** diff --git a/composer.lock b/composer.lock index ca3c37ebd1..8d56175ffd 100644 --- a/composer.lock +++ b/composer.lock @@ -584,16 +584,16 @@ }, { "name": "doctrine/deprecations", - "version": "v1.0.0", + "version": "v1.1.0", "source": { "type": "git", "url": "https://github.com/doctrine/deprecations.git", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de" + "reference": "8cffffb2218e01f3b370bf763e00e81697725259" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/deprecations/zipball/0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", - "reference": "0e2a4f1f8cdfc7a92ec3b01c9334898c806b30de", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/8cffffb2218e01f3b370bf763e00e81697725259", + "reference": "8cffffb2218e01f3b370bf763e00e81697725259", "shasum": "" }, "require": { @@ -621,9 +621,9 @@ "homepage": "https://www.doctrine-project.org/", "support": { "issues": "https://github.com/doctrine/deprecations/issues", - "source": "https://github.com/doctrine/deprecations/tree/v1.0.0" + "source": "https://github.com/doctrine/deprecations/tree/v1.1.0" }, - "time": "2022-05-02T15:47:09+00:00" + "time": "2023-05-29T18:55:17+00:00" }, { "name": "doctrine/event-manager", @@ -1937,16 +1937,16 @@ }, { "name": "laravel/framework", - "version": "v10.12.0", + "version": "v10.13.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "9e6dcff23ab1d4b522bef56074c31625cf077576" + "reference": "7322723585103082758d74917db62980684845cb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/9e6dcff23ab1d4b522bef56074c31625cf077576", - "reference": "9e6dcff23ab1d4b522bef56074c31625cf077576", + "url": "https://api.github.com/repos/laravel/framework/zipball/7322723585103082758d74917db62980684845cb", + "reference": "7322723585103082758d74917db62980684845cb", "shasum": "" }, "require": { @@ -2133,7 +2133,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-05-23T18:04:16+00:00" + "time": "2023-05-30T14:46:25+00:00" }, { "name": "laravel/passport", @@ -5868,23 +5868,23 @@ }, { "name": "symfony/console", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77" + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5aa03db8ef0a5457c316ec580e69562d97734c77", - "reference": "5aa03db8ef0a5457c316ec580e69562d97734c77", + "url": "https://api.github.com/repos/symfony/console/zipball/8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", + "reference": "8788808b07cf0bdd6e4b7fdd23d8ddb1470c83b7", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/string": "^5.4|^6.0" }, "conflict": { @@ -5906,12 +5906,6 @@ "symfony/process": "^5.4|^6.0", "symfony/var-dumper": "^5.4|^6.0" }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" - }, "type": "library", "autoload": { "psr-4": { @@ -5944,7 +5938,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v6.2.11" + "source": "https://github.com/symfony/console/tree/v6.3.0" }, "funding": [ { @@ -5960,20 +5954,20 @@ "type": "tidelift" } ], - "time": "2023-05-26T08:16:21+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/css-selector", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "aedf3cb0f5b929ec255d96bbb4909e9932c769e0" + "reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/aedf3cb0f5b929ec255d96bbb4909e9932c769e0", - "reference": "aedf3cb0f5b929ec255d96bbb4909e9932c769e0", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf", + "reference": "88453e64cd86c5b60e8d2fb2c6f953bbc353ffbf", "shasum": "" }, "require": { @@ -6009,7 +6003,7 @@ "description": "Converts CSS selectors to XPath expressions", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/css-selector/tree/v6.2.7" + "source": "https://github.com/symfony/css-selector/tree/v6.3.0" }, "funding": [ { @@ -6025,20 +6019,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-03-20T16:43:42+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e" + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", - "reference": "e2d1534420bd723d0ef5aec58a22c5fe60ce6f5e", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/7c3aff79d10325257a001fcf92d991f24fc967cf", + "reference": "7c3aff79d10325257a001fcf92d991f24fc967cf", "shasum": "" }, "require": { @@ -6047,7 +6041,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -6076,7 +6070,7 @@ "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.3.0" }, "funding": [ { @@ -6092,20 +6086,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:25:55+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/error-handler", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/error-handler.git", - "reference": "e847ba47e7a8f9708082990cb40ab4ff0440a11e" + "reference": "99d2d814a6351461af350ead4d963bd67451236f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/error-handler/zipball/e847ba47e7a8f9708082990cb40ab4ff0440a11e", - "reference": "e847ba47e7a8f9708082990cb40ab4ff0440a11e", + "url": "https://api.github.com/repos/symfony/error-handler/zipball/99d2d814a6351461af350ead4d963bd67451236f", + "reference": "99d2d814a6351461af350ead4d963bd67451236f", "shasum": "" }, "require": { @@ -6113,8 +6107,11 @@ "psr/log": "^1|^2|^3", "symfony/var-dumper": "^5.4|^6.0" }, + "conflict": { + "symfony/deprecation-contracts": "<2.5" + }, "require-dev": { - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-kernel": "^5.4|^6.0", "symfony/serializer": "^5.4|^6.0" }, @@ -6147,7 +6144,7 @@ "description": "Provides tools to manage errors and ease debugging PHP code", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/error-handler/tree/v6.2.11" + "source": "https://github.com/symfony/error-handler/tree/v6.3.0" }, "funding": [ { @@ -6163,28 +6160,29 @@ "type": "tidelift" } ], - "time": "2023-05-05T11:55:01+00:00" + "time": "2023-05-10T12:03:13+00:00" }, { "name": "symfony/event-dispatcher", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339" + "reference": "3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/04046f35fd7d72f9646e721fc2ecb8f9c67d3339", - "reference": "04046f35fd7d72f9646e721fc2ecb8f9c67d3339", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa", + "reference": "3af8ac1a3f98f6dbc55e10ae59c9e44bfc38dfaa", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/event-dispatcher-contracts": "^2|^3" + "symfony/event-dispatcher-contracts": "^2.5|^3" }, "conflict": { - "symfony/dependency-injection": "<5.4" + "symfony/dependency-injection": "<5.4", + "symfony/service-contracts": "<2.5" }, "provide": { "psr/event-dispatcher-implementation": "1.0", @@ -6197,13 +6195,9 @@ "symfony/error-handler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/http-foundation": "^5.4|^6.0", - "symfony/service-contracts": "^1.1|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/stopwatch": "^5.4|^6.0" }, - "suggest": { - "symfony/dependency-injection": "", - "symfony/http-kernel": "" - }, "type": "library", "autoload": { "psr-4": { @@ -6230,7 +6224,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v6.2.8" + "source": "https://github.com/symfony/event-dispatcher/tree/v6.3.0" }, "funding": [ { @@ -6246,33 +6240,30 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-04-21T14:41:17+00:00" }, { "name": "symfony/event-dispatcher-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher-contracts.git", - "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd" + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", - "reference": "0ad3b6f1e4e2da5690fefe075cd53a238646d8dd", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/a76aed96a42d2b521153fb382d418e30d18b59df", + "reference": "a76aed96a42d2b521153fb382d418e30d18b59df", "shasum": "" }, "require": { "php": ">=8.1", "psr/event-dispatcher": "^1" }, - "suggest": { - "symfony/event-dispatcher-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -6309,7 +6300,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.3.0" }, "funding": [ { @@ -6325,20 +6316,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/finder", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb" + "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/20808dc6631aecafbe67c186af5dcb370be3a0eb", - "reference": "20808dc6631aecafbe67c186af5dcb370be3a0eb", + "url": "https://api.github.com/repos/symfony/finder/zipball/d9b01ba073c44cef617c7907ce2419f8d00d75e2", + "reference": "d9b01ba073c44cef617c7907ce2419f8d00d75e2", "shasum": "" }, "require": { @@ -6373,7 +6364,7 @@ "description": "Finds files and directories via an intuitive fluent interface", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/finder/tree/v6.2.7" + "source": "https://github.com/symfony/finder/tree/v6.3.0" }, "funding": [ { @@ -6389,28 +6380,32 @@ "type": "tidelift" } ], - "time": "2023-02-16T09:57:23+00:00" + "time": "2023-04-02T01:25:41+00:00" }, { "name": "symfony/http-client", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client.git", - "reference": "39f679c12648cc43bd9f0db12cc69b82041b91a1" + "reference": "b2f892c91e4e02a939edddeb7ef452522d10a424" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client/zipball/39f679c12648cc43bd9f0db12cc69b82041b91a1", - "reference": "39f679c12648cc43bd9f0db12cc69b82041b91a1", + "url": "https://api.github.com/repos/symfony/http-client/zipball/b2f892c91e4e02a939edddeb7ef452522d10a424", + "reference": "b2f892c91e4e02a939edddeb7ef452522d10a424", "shasum": "" }, "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/http-client-contracts": "^3", - "symfony/service-contracts": "^1.0|^2|^3" + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "php-http/discovery": "<1.15", + "symfony/http-foundation": "<6.3" }, "provide": { "php-http/async-client-implementation": "*", @@ -6426,7 +6421,6 @@ "guzzlehttp/promises": "^1.4", "nyholm/psr7": "^1.0", "php-http/httplug": "^1.0|^2.0", - "php-http/message-factory": "^1.0", "psr/http-client": "^1.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/http-kernel": "^5.4|^6.0", @@ -6462,7 +6456,7 @@ "http" ], "support": { - "source": "https://github.com/symfony/http-client/tree/v6.2.11" + "source": "https://github.com/symfony/http-client/tree/v6.3.0" }, "funding": [ { @@ -6478,32 +6472,29 @@ "type": "tidelift" } ], - "time": "2023-05-12T08:48:34+00:00" + "time": "2023-05-12T08:49:48+00:00" }, { "name": "symfony/http-client-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-client-contracts.git", - "reference": "df2ecd6cb70e73c1080e6478aea85f5f4da2c48b" + "reference": "3b66325d0176b4ec826bffab57c9037d759c31fb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/df2ecd6cb70e73c1080e6478aea85f5f4da2c48b", - "reference": "df2ecd6cb70e73c1080e6478aea85f5f4da2c48b", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/3b66325d0176b4ec826bffab57c9037d759c31fb", + "reference": "3b66325d0176b4ec826bffab57c9037d759c31fb", "shasum": "" }, "require": { "php": ">=8.1" }, - "suggest": { - "symfony/http-client-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -6543,7 +6534,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/http-client-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/http-client-contracts/tree/v3.3.0" }, "funding": [ { @@ -6559,32 +6550,34 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/http-foundation", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "df27f4191a4292d01fd062296e09cbc8b657cb57" + "reference": "718a97ed430d34e5c568ea2c44eab708c6efbefb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/df27f4191a4292d01fd062296e09cbc8b657cb57", - "reference": "df27f4191a4292d01fd062296e09cbc8b657cb57", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/718a97ed430d34e5c568ea2c44eab708c6efbefb", + "reference": "718a97ed430d34e5c568ea2c44eab708c6efbefb", "shasum": "" }, "require": { "php": ">=8.1", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/polyfill-mbstring": "~1.1" + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.1", + "symfony/polyfill-php83": "^1.27" }, "conflict": { "symfony/cache": "<6.2" }, "require-dev": { - "predis/predis": "~1.0", + "doctrine/dbal": "^2.13.1|^3.0", + "predis/predis": "^1.1|^2.0", "symfony/cache": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", @@ -6592,9 +6585,6 @@ "symfony/mime": "^5.4|^6.0", "symfony/rate-limiter": "^5.2|^6.0" }, - "suggest": { - "symfony/mime": "To use the file extension guesser" - }, "type": "library", "autoload": { "psr-4": { @@ -6621,7 +6611,7 @@ "description": "Defines an object-oriented layer for the HTTP specification", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-foundation/tree/v6.2.11" + "source": "https://github.com/symfony/http-foundation/tree/v6.3.0" }, "funding": [ { @@ -6637,29 +6627,29 @@ "type": "tidelift" } ], - "time": "2023-05-19T12:39:53+00:00" + "time": "2023-05-19T12:46:45+00:00" }, { "name": "symfony/http-kernel", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "954a1a3b178309b216261eedc735c079709e4ab3" + "reference": "241973f3dd900620b1ca052fe409144f11aea748" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/954a1a3b178309b216261eedc735c079709e4ab3", - "reference": "954a1a3b178309b216261eedc735c079709e4ab3", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/241973f3dd900620b1ca052fe409144f11aea748", + "reference": "241973f3dd900620b1ca052fe409144f11aea748", "shasum": "" }, "require": { "php": ">=8.1", "psr/log": "^1|^2|^3", - "symfony/deprecation-contracts": "^2.1|^3", - "symfony/error-handler": "^6.1", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/error-handler": "^6.3", "symfony/event-dispatcher": "^5.4|^6.0", - "symfony/http-foundation": "^5.4.21|^6.2.7", + "symfony/http-foundation": "^6.2.7", "symfony/polyfill-ctype": "^1.8" }, "conflict": { @@ -6667,15 +6657,18 @@ "symfony/cache": "<5.4", "symfony/config": "<6.1", "symfony/console": "<5.4", - "symfony/dependency-injection": "<6.2", + "symfony/dependency-injection": "<6.3", "symfony/doctrine-bridge": "<5.4", "symfony/form": "<5.4", "symfony/http-client": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/mailer": "<5.4", "symfony/messenger": "<5.4", "symfony/translation": "<5.4", + "symfony/translation-contracts": "<2.5", "symfony/twig-bridge": "<5.4", "symfony/validator": "<5.4", + "symfony/var-dumper": "<6.3", "twig/twig": "<2.13" }, "provide": { @@ -6684,29 +6677,27 @@ "require-dev": { "psr/cache": "^1.0|^2.0|^3.0", "symfony/browser-kit": "^5.4|^6.0", + "symfony/clock": "^6.2", "symfony/config": "^6.1", "symfony/console": "^5.4|^6.0", "symfony/css-selector": "^5.4|^6.0", - "symfony/dependency-injection": "^6.2", + "symfony/dependency-injection": "^6.3", "symfony/dom-crawler": "^5.4|^6.0", "symfony/expression-language": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2|^3", + "symfony/http-client-contracts": "^2.5|^3", "symfony/process": "^5.4|^6.0", + "symfony/property-access": "^5.4.5|^6.0.5", "symfony/routing": "^5.4|^6.0", + "symfony/serializer": "^6.3", "symfony/stopwatch": "^5.4|^6.0", "symfony/translation": "^5.4|^6.0", - "symfony/translation-contracts": "^1.1|^2|^3", + "symfony/translation-contracts": "^2.5|^3", "symfony/uid": "^5.4|^6.0", + "symfony/validator": "^6.3", "symfony/var-exporter": "^6.2", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "symfony/browser-kit": "", - "symfony/config": "", - "symfony/console": "", - "symfony/dependency-injection": "" - }, "type": "library", "autoload": { "psr-4": { @@ -6733,7 +6724,7 @@ "description": "Provides a structured process for converting a Request into a Response", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/http-kernel/tree/v6.2.11" + "source": "https://github.com/symfony/http-kernel/tree/v6.3.0" }, "funding": [ { @@ -6749,20 +6740,20 @@ "type": "tidelift" } ], - "time": "2023-05-27T21:12:52+00:00" + "time": "2023-05-30T19:03:32+00:00" }, { "name": "symfony/mailer", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17" + "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", - "reference": "bfcfa015c67e19c6fdb7ca6fe70700af1e740a17", + "url": "https://api.github.com/repos/symfony/mailer/zipball/7b03d9be1dea29bfec0a6c7b603f5072a4c97435", + "reference": "7b03d9be1dea29bfec0a6c7b603f5072a4c97435", "shasum": "" }, "require": { @@ -6772,9 +6763,10 @@ "psr/log": "^1|^2|^3", "symfony/event-dispatcher": "^5.4|^6.0", "symfony/mime": "^6.2", - "symfony/service-contracts": "^1.1|^2|^3" + "symfony/service-contracts": "^2.5|^3" }, "conflict": { + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", "symfony/messenger": "<6.2", "symfony/mime": "<6.2", @@ -6812,7 +6804,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.2.8" + "source": "https://github.com/symfony/mailer/tree/v6.3.0" }, "funding": [ { @@ -6828,28 +6820,32 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:00:05+00:00" + "time": "2023-05-29T12:49:39+00:00" }, { "name": "symfony/mailgun-mailer", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/mailgun-mailer.git", - "reference": "2c9d47b11cc154d2db3f571030cd965d128de1a8" + "reference": "2fafefe8683a93155aceb6cca622c7cee2e27174" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/2c9d47b11cc154d2db3f571030cd965d128de1a8", - "reference": "2c9d47b11cc154d2db3f571030cd965d128de1a8", + "url": "https://api.github.com/repos/symfony/mailgun-mailer/zipball/2fafefe8683a93155aceb6cca622c7cee2e27174", + "reference": "2fafefe8683a93155aceb6cca622c7cee2e27174", "shasum": "" }, "require": { "php": ">=8.1", "symfony/mailer": "^5.4.21|^6.2.7" }, + "conflict": { + "symfony/http-foundation": "<6.2" + }, "require-dev": { - "symfony/http-client": "^5.4|^6.0" + "symfony/http-client": "^5.4|^6.0", + "symfony/webhook": "^6.3" }, "type": "symfony-mailer-bridge", "autoload": { @@ -6877,7 +6873,7 @@ "description": "Symfony Mailgun Mailer Bridge", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailgun-mailer/tree/v6.2.10" + "source": "https://github.com/symfony/mailgun-mailer/tree/v6.3.0" }, "funding": [ { @@ -6893,20 +6889,20 @@ "type": "tidelift" } ], - "time": "2023-04-14T16:23:31+00:00" + "time": "2023-05-02T16:15:19+00:00" }, { "name": "symfony/mime", - "version": "v6.2.10", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723" + "reference": "7b5d2121858cd6efbed778abce9cfdd7ab1f62ad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/b6c137fc53a9f7c4c951cd3f362b3734c7a97723", - "reference": "b6c137fc53a9f7c4c951cd3f362b3734c7a97723", + "url": "https://api.github.com/repos/symfony/mime/zipball/7b5d2121858cd6efbed778abce9cfdd7ab1f62ad", + "reference": "7b5d2121858cd6efbed778abce9cfdd7ab1f62ad", "shasum": "" }, "require": { @@ -6960,7 +6956,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v6.2.10" + "source": "https://github.com/symfony/mime/tree/v6.3.0" }, "funding": [ { @@ -6976,7 +6972,7 @@ "type": "tidelift" } ], - "time": "2023-04-19T09:54:16+00:00" + "time": "2023-04-28T15:57:00+00:00" }, { "name": "symfony/polyfill-ctype", @@ -7554,6 +7550,83 @@ ], "time": "2022-11-03T14:55:06+00:00" }, + { + "name": "symfony/polyfill-php83", + "version": "v1.27.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/508c652ba3ccf69f8c97f251534f229791b52a57", + "reference": "508c652ba3ccf69f8c97f251534f229791b52a57", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "symfony/polyfill-php80": "^1.14" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "1.27-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.27.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-11-03T14:55:06+00:00" + }, { "name": "symfony/polyfill-uuid", "version": "v1.27.0", @@ -7638,16 +7711,16 @@ }, { "name": "symfony/process", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c" + "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/97ae9721bead9d1a39b5650e2f4b7834b93b539c", - "reference": "97ae9721bead9d1a39b5650e2f4b7834b93b539c", + "url": "https://api.github.com/repos/symfony/process/zipball/8741e3ed7fe2e91ec099e02446fb86667a0f1628", + "reference": "8741e3ed7fe2e91ec099e02446fb86667a0f1628", "shasum": "" }, "require": { @@ -7679,7 +7752,7 @@ "description": "Executes commands in sub-processes", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/process/tree/v6.2.11" + "source": "https://github.com/symfony/process/tree/v6.3.0" }, "funding": [ { @@ -7695,7 +7768,7 @@ "type": "tidelift" } ], - "time": "2023-05-19T07:42:48+00:00" + "time": "2023-05-19T08:06:44+00:00" }, { "name": "symfony/psr-http-message-bridge", @@ -7787,16 +7860,16 @@ }, { "name": "symfony/routing", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "69062e2823f03b82265d73a966999660f0e1e404" + "reference": "827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/69062e2823f03b82265d73a966999660f0e1e404", - "reference": "69062e2823f03b82265d73a966999660f0e1e404", + "url": "https://api.github.com/repos/symfony/routing/zipball/827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b", + "reference": "827f59fdc67eecfc4dfff81f9c93bf4d98f0c89b", "shasum": "" }, "require": { @@ -7817,12 +7890,6 @@ "symfony/http-foundation": "^5.4|^6.0", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "symfony/config": "For using the all-in-one router or any loader", - "symfony/expression-language": "For using expression matching", - "symfony/http-foundation": "For using a Symfony Request object", - "symfony/yaml": "For using the YAML loader" - }, "type": "library", "autoload": { "psr-4": { @@ -7855,7 +7922,7 @@ "url" ], "support": { - "source": "https://github.com/symfony/routing/tree/v6.2.8" + "source": "https://github.com/symfony/routing/tree/v6.3.0" }, "funding": [ { @@ -7871,20 +7938,20 @@ "type": "tidelift" } ], - "time": "2023-03-14T15:00:05+00:00" + "time": "2023-04-28T15:57:00+00:00" }, { "name": "symfony/service-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a" + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/a8c9cedf55f314f3a186041d19537303766df09a", - "reference": "a8c9cedf55f314f3a186041d19537303766df09a", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", + "reference": "40da9cc13ec349d9e4966ce18b5fbcd724ab10a4", "shasum": "" }, "require": { @@ -7894,13 +7961,10 @@ "conflict": { "ext-psr": "<1.1|>=2" }, - "suggest": { - "symfony/service-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -7940,7 +8004,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/service-contracts/tree/v3.3.0" }, "funding": [ { @@ -7956,20 +8020,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-23T14:45:45+00:00" }, { "name": "symfony/string", - "version": "v6.2.8", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef" + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/193e83bbd6617d6b2151c37fff10fa7168ebddef", - "reference": "193e83bbd6617d6b2151c37fff10fa7168ebddef", + "url": "https://api.github.com/repos/symfony/string/zipball/f2e190ee75ff0f5eced645ec0be5c66fac81f51f", + "reference": "f2e190ee75ff0f5eced645ec0be5c66fac81f51f", "shasum": "" }, "require": { @@ -7980,13 +8044,13 @@ "symfony/polyfill-mbstring": "~1.0" }, "conflict": { - "symfony/translation-contracts": "<2.0" + "symfony/translation-contracts": "<2.5" }, "require-dev": { "symfony/error-handler": "^5.4|^6.0", "symfony/http-client": "^5.4|^6.0", "symfony/intl": "^6.2", - "symfony/translation-contracts": "^2.0|^3.0", + "symfony/translation-contracts": "^2.5|^3.0", "symfony/var-exporter": "^5.4|^6.0" }, "type": "library", @@ -8026,7 +8090,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v6.2.8" + "source": "https://github.com/symfony/string/tree/v6.3.0" }, "funding": [ { @@ -8042,32 +8106,34 @@ "type": "tidelift" } ], - "time": "2023-03-20T16:06:02+00:00" + "time": "2023-03-21T21:06:29+00:00" }, { "name": "symfony/translation", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "64113df3e8b009f92fad63014f4ec647e65bc927" + "reference": "f72b2cba8f79dd9d536f534f76874b58ad37876f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/64113df3e8b009f92fad63014f4ec647e65bc927", - "reference": "64113df3e8b009f92fad63014f4ec647e65bc927", + "url": "https://api.github.com/repos/symfony/translation/zipball/f72b2cba8f79dd9d536f534f76874b58ad37876f", + "reference": "f72b2cba8f79dd9d536f534f76874b58ad37876f", "shasum": "" }, "require": { "php": ">=8.1", "symfony/polyfill-mbstring": "~1.0", - "symfony/translation-contracts": "^2.3|^3.0" + "symfony/translation-contracts": "^2.5|^3.0" }, "conflict": { "symfony/config": "<5.4", "symfony/console": "<5.4", "symfony/dependency-injection": "<5.4", + "symfony/http-client-contracts": "<2.5", "symfony/http-kernel": "<5.4", + "symfony/service-contracts": "<2.5", "symfony/twig-bundle": "<5.4", "symfony/yaml": "<5.4" }, @@ -8081,20 +8147,14 @@ "symfony/console": "^5.4|^6.0", "symfony/dependency-injection": "^5.4|^6.0", "symfony/finder": "^5.4|^6.0", - "symfony/http-client-contracts": "^1.1|^2.0|^3.0", + "symfony/http-client-contracts": "^2.5|^3.0", "symfony/http-kernel": "^5.4|^6.0", "symfony/intl": "^5.4|^6.0", "symfony/polyfill-intl-icu": "^1.21", "symfony/routing": "^5.4|^6.0", - "symfony/service-contracts": "^1.1.2|^2|^3", + "symfony/service-contracts": "^2.5|^3", "symfony/yaml": "^5.4|^6.0" }, - "suggest": { - "nikic/php-parser": "To use PhpAstExtractor", - "psr/log-implementation": "To use logging capability in translator", - "symfony/config": "", - "symfony/yaml": "" - }, "type": "library", "autoload": { "files": [ @@ -8124,7 +8184,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v6.2.11" + "source": "https://github.com/symfony/translation/tree/v6.3.0" }, "funding": [ { @@ -8140,32 +8200,29 @@ "type": "tidelift" } ], - "time": "2023-05-19T12:37:14+00:00" + "time": "2023-05-19T12:46:45+00:00" }, { "name": "symfony/translation-contracts", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/symfony/translation-contracts.git", - "reference": "dfec258b9dd17a6b24420d464c43bffe347441c8" + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/dfec258b9dd17a6b24420d464c43bffe347441c8", - "reference": "dfec258b9dd17a6b24420d464c43bffe347441c8", + "url": "https://api.github.com/repos/symfony/translation-contracts/zipball/02c24deb352fb0d79db5486c0c79905a85e37e86", + "reference": "02c24deb352fb0d79db5486c0c79905a85e37e86", "shasum": "" }, "require": { "php": ">=8.1" }, - "suggest": { - "symfony/translation-implementation": "" - }, "type": "library", "extra": { "branch-alias": { - "dev-main": "3.3-dev" + "dev-main": "3.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -8205,7 +8262,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/translation-contracts/tree/v3.2.1" + "source": "https://github.com/symfony/translation-contracts/tree/v3.3.0" }, "funding": [ { @@ -8221,20 +8278,20 @@ "type": "tidelift" } ], - "time": "2023-03-01T10:32:47+00:00" + "time": "2023-05-30T17:17:10+00:00" }, { "name": "symfony/uid", - "version": "v6.2.7", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/uid.git", - "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0" + "reference": "01b0f20b1351d997711c56f1638f7a8c3061e384" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/uid/zipball/d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", - "reference": "d30c72a63897cfa043e1de4d4dd2ffa9ecefcdc0", + "url": "https://api.github.com/repos/symfony/uid/zipball/01b0f20b1351d997711c56f1638f7a8c3061e384", + "reference": "01b0f20b1351d997711c56f1638f7a8c3061e384", "shasum": "" }, "require": { @@ -8279,7 +8336,7 @@ "uuid" ], "support": { - "source": "https://github.com/symfony/uid/tree/v6.2.7" + "source": "https://github.com/symfony/uid/tree/v6.3.0" }, "funding": [ { @@ -8295,20 +8352,20 @@ "type": "tidelift" } ], - "time": "2023-02-14T08:44:56+00:00" + "time": "2023-04-08T07:25:02+00:00" }, { "name": "symfony/var-dumper", - "version": "v6.2.11", + "version": "v6.3.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "7d10f2a5a452bda385692fc7d38cd6eccfebe756" + "reference": "6acdcd5c122074ee9f7b051e4fb177025c277a0e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/7d10f2a5a452bda385692fc7d38cd6eccfebe756", - "reference": "7d10f2a5a452bda385692fc7d38cd6eccfebe756", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6acdcd5c122074ee9f7b051e4fb177025c277a0e", + "reference": "6acdcd5c122074ee9f7b051e4fb177025c277a0e", "shasum": "" }, "require": { @@ -8325,11 +8382,6 @@ "symfony/uid": "^5.4|^6.0", "twig/twig": "^2.13|^3.0.4" }, - "suggest": { - "ext-iconv": "To convert non-UTF-8 strings to UTF-8 (or symfony/polyfill-iconv in case ext-iconv cannot be used).", - "ext-intl": "To show region name in time zone dump", - "symfony/console": "To use the ServerDumpCommand and/or the bin/var-dump-server script" - }, "bin": [ "Resources/bin/var-dump-server" ], @@ -8366,7 +8418,7 @@ "dump" ], "support": { - "source": "https://github.com/symfony/var-dumper/tree/v6.2.11" + "source": "https://github.com/symfony/var-dumper/tree/v6.3.0" }, "funding": [ { @@ -8382,7 +8434,7 @@ "type": "tidelift" } ], - "time": "2023-05-25T13:08:43+00:00" + "time": "2023-05-25T13:09:35+00:00" }, { "name": "therobfonz/laravel-mandrill-driver", @@ -9717,16 +9769,16 @@ }, { "name": "phpdocumentor/type-resolver", - "version": "1.7.1", + "version": "1.7.2", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "dfc078e8af9c99210337325ff5aa152872c98714" + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/dfc078e8af9c99210337325ff5aa152872c98714", - "reference": "dfc078e8af9c99210337325ff5aa152872c98714", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/b2fe4d22a5426f38e014855322200b97b5362c0d", + "reference": "b2fe4d22a5426f38e014855322200b97b5362c0d", "shasum": "" }, "require": { @@ -9769,9 +9821,9 @@ "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.1" + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.7.2" }, - "time": "2023-03-27T19:02:04+00:00" + "time": "2023-05-30T18:13:47+00:00" }, { "name": "phpmyadmin/sql-parser", @@ -9862,22 +9914,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.21.0", + "version": "1.22.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c" + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6df62b08faef4f899772bc7c3bbabb93d2b7a21c", - "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", + "reference": "ec58baf7b3c7f1c81b3b00617c953249fb8cf30c", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "doctrine/annotations": "^2.0", "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", @@ -9902,9 +9955,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.0" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.22.0" }, - "time": "2023-05-17T13:13:44+00:00" + "time": "2023-06-01T12:35:21+00:00" }, { "name": "phpstan/phpstan", diff --git a/database/seeders/ConfigSeeder.php b/database/seeders/ConfigSeeder.php index 7005d71345..b1ade84b80 100644 --- a/database/seeders/ConfigSeeder.php +++ b/database/seeders/ConfigSeeder.php @@ -39,8 +39,6 @@ class ConfigSeeder extends Seeder { $entry = Configuration::where('name', 'db_version')->first(); if (null === $entry) { - Log::warning('No database version entry is present. Database is assumed to be OLD (version 1).'); - // FF old or no version present. Put at 1: Configuration::create( [ 'name' => 'db_version', @@ -52,8 +50,6 @@ class ConfigSeeder extends Seeder $version = (int)config('firefly.db_version'); $entry->data = $version; $entry->save(); - - Log::warning(sprintf('Database entry exists. Update to latest version (%d)', $version)); } } }