Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Give commands proper exit codes.
James Coled193a6aec418
diff --git a/app/Console/Commands/Import.php b/app/Console/Commands/Import.phpindex 0446f6ccc5..5d6d853f59 100644--- a/app/Console/Commands/Import.php+++ b/app/Console/Commands/Import.php@@ -59,7 +59,7 @@ class Import extends Command** @throws FireflyException*/- public function handle(): void+ public function handle(): int{Log::debug('Start start-import command');$jobKey = $this->argument('key');@@ -67,12 +67,12 @@ class Import extends Commandif (null === $job) {$this->errorLine(sprintf('No job found with key "%s"', $jobKey));- return;+ return 1;}if (!$this->isValid($job)) {$this->errorLine('Job is not valid for some reason. Exit.');- return;+ return 1;}$this->infoLine(sprintf('Going to import job with key "%s" of type "%s"', $job->key, $job->file_type));@@ -106,6 +106,8 @@ class Import extends Command}$this->infoLine(sprintf('The import has finished. %d transactions have been imported.', $count));++ return 0;}/**diff --git a/app/Console/Commands/ScanAttachments.php b/app/Console/Commands/ScanAttachments.phpindex ac10dec27f..0a77363a0a 100644--- a/app/Console/Commands/ScanAttachments.php+++ b/app/Console/Commands/ScanAttachments.php@@ -54,7 +54,7 @@ class ScanAttachments extends Command/*** Execute the console command.*/- public function handle(): void+ public function handle(): int{$attachments = Attachment::get();$disk = Storage::disk('upload');@@ -82,5 +82,6 @@ class ScanAttachments extends Command$attachment->save();$this->line(sprintf('Fixed attachment #%d', $attachment->id));}+ return 0;}}diff --git a/app/Console/Commands/UpgradeDatabase.php b/app/Console/Commands/UpgradeDatabase.phpindex 5c328ac60f..927630bc50 100644--- a/app/Console/Commands/UpgradeDatabase.php+++ b/app/Console/Commands/UpgradeDatabase.php@@ -82,7 +82,7 @@ class UpgradeDatabase extends Command/*** Execute the console command.*/- public function handle(): void+ public function handle(): int{$this->setTransactionIdentifier();$this->updateAccountCurrencies();@@ -96,6 +96,8 @@ class UpgradeDatabase extends Command$this->migrateBillsToRules();$this->info('Firefly III database is up to date.');++ return 0;}/**diff --git a/app/Console/Commands/UpgradeFireflyInstructions.php b/app/Console/Commands/UpgradeFireflyInstructions.phpindex eae3998a22..54695221c4 100644--- a/app/Console/Commands/UpgradeFireflyInstructions.php+++ b/app/Console/Commands/UpgradeFireflyInstructions.php@@ -46,7 +46,7 @@ class UpgradeFireflyInstructions extends Command/*** Execute the console command.*/- public function handle(): void+ public function handle(): int{if ('update' === $this->argument('task')) {$this->updateInstructions();@@ -54,6 +54,7 @@ class UpgradeFireflyInstructions extends Commandif ('install' === $this->argument('task')) {$this->installInstructions();}+ return 0;}/**diff --git a/app/Console/Commands/UseEncryption.php b/app/Console/Commands/UseEncryption.phpindex df38fff556..bfc04db91c 100644--- a/app/Console/Commands/UseEncryption.php+++ b/app/Console/Commands/UseEncryption.php@@ -47,7 +47,7 @@ class UseEncryption extends Command/*** Execute the console command.*/- public function handle(): void+ public function handle(): int{if (true === config('firefly.encryption')) {$this->info('Firefly III configuration calls for encrypted data.');@@ -62,6 +62,7 @@ class UseEncryption extends Command$this->handleObjects('Category', 'name', 'encrypted');$this->handleObjects('PiggyBank', 'name', 'encrypted');$this->handleObjects('TransactionJournal', 'description', 'encrypted');+ return 0;}/**diff --git a/app/Console/Commands/VerifyDatabase.php b/app/Console/Commands/VerifyDatabase.phpindex dc43c373bb..88635664ae 100644--- a/app/Console/Commands/VerifyDatabase.php+++ b/app/Console/Commands/VerifyDatabase.php@@ -69,11 +69,11 @@ class VerifyDatabase extends Command/*** Execute the console command.*/- public function handle(): void+ public function handle(): int{// if table does not exist, return falseif (!Schema::hasTable('users')) {- return;+ return 1;}$this->reportEmptyBudgets();@@ -94,6 +94,8 @@ class VerifyDatabase extends Command$this->fixDoubleAmounts();$this->fixBadMeta();$this->removeBills();++ return 0;}/**