mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-19 02:45:58 +00:00
Give commands proper exit codes.
This commit is contained in:
@@ -59,7 +59,7 @@ class Import extends Command
|
|||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @throws FireflyException
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
Log::debug('Start start-import command');
|
Log::debug('Start start-import command');
|
||||||
$jobKey = $this->argument('key');
|
$jobKey = $this->argument('key');
|
||||||
@@ -67,12 +67,12 @@ class Import extends Command
|
|||||||
if (null === $job) {
|
if (null === $job) {
|
||||||
$this->errorLine(sprintf('No job found with key "%s"', $jobKey));
|
$this->errorLine(sprintf('No job found with key "%s"', $jobKey));
|
||||||
|
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!$this->isValid($job)) {
|
if (!$this->isValid($job)) {
|
||||||
$this->errorLine('Job is not valid for some reason. Exit.');
|
$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));
|
$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));
|
$this->infoLine(sprintf('The import has finished. %d transactions have been imported.', $count));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -54,7 +54,7 @@ class ScanAttachments extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$attachments = Attachment::get();
|
$attachments = Attachment::get();
|
||||||
$disk = Storage::disk('upload');
|
$disk = Storage::disk('upload');
|
||||||
@@ -82,5 +82,6 @@ class ScanAttachments extends Command
|
|||||||
$attachment->save();
|
$attachment->save();
|
||||||
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
|
$this->line(sprintf('Fixed attachment #%d', $attachment->id));
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -82,7 +82,7 @@ class UpgradeDatabase extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
$this->setTransactionIdentifier();
|
$this->setTransactionIdentifier();
|
||||||
$this->updateAccountCurrencies();
|
$this->updateAccountCurrencies();
|
||||||
@@ -96,6 +96,8 @@ class UpgradeDatabase extends Command
|
|||||||
$this->migrateBillsToRules();
|
$this->migrateBillsToRules();
|
||||||
|
|
||||||
$this->info('Firefly III database is up to date.');
|
$this->info('Firefly III database is up to date.');
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -46,7 +46,7 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
if ('update' === $this->argument('task')) {
|
if ('update' === $this->argument('task')) {
|
||||||
$this->updateInstructions();
|
$this->updateInstructions();
|
||||||
@@ -54,6 +54,7 @@ class UpgradeFireflyInstructions extends Command
|
|||||||
if ('install' === $this->argument('task')) {
|
if ('install' === $this->argument('task')) {
|
||||||
$this->installInstructions();
|
$this->installInstructions();
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -47,7 +47,7 @@ class UseEncryption extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
if (true === config('firefly.encryption')) {
|
if (true === config('firefly.encryption')) {
|
||||||
$this->info('Firefly III configuration calls for encrypted data.');
|
$this->info('Firefly III configuration calls for encrypted data.');
|
||||||
@@ -62,6 +62,7 @@ class UseEncryption extends Command
|
|||||||
$this->handleObjects('Category', 'name', 'encrypted');
|
$this->handleObjects('Category', 'name', 'encrypted');
|
||||||
$this->handleObjects('PiggyBank', 'name', 'encrypted');
|
$this->handleObjects('PiggyBank', 'name', 'encrypted');
|
||||||
$this->handleObjects('TransactionJournal', 'description', 'encrypted');
|
$this->handleObjects('TransactionJournal', 'description', 'encrypted');
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -69,11 +69,11 @@ class VerifyDatabase extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
public function handle(): void
|
public function handle(): int
|
||||||
{
|
{
|
||||||
// if table does not exist, return false
|
// if table does not exist, return false
|
||||||
if (!Schema::hasTable('users')) {
|
if (!Schema::hasTable('users')) {
|
||||||
return;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->reportEmptyBudgets();
|
$this->reportEmptyBudgets();
|
||||||
@@ -94,6 +94,8 @@ class VerifyDatabase extends Command
|
|||||||
$this->fixDoubleAmounts();
|
$this->fixDoubleAmounts();
|
||||||
$this->fixBadMeta();
|
$this->fixBadMeta();
|
||||||
$this->removeBills();
|
$this->removeBills();
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user