Rename command.

This commit is contained in:
James Cole
2025-08-15 20:00:29 +02:00
parent 77d15f884b
commit a916cc7e78

View File

@@ -50,7 +50,7 @@ class Cron extends Command
{--download-cer : Download exchange rates. Other tasks will be skipped unless also requested.} {--download-cer : Download exchange rates. Other tasks will be skipped unless also requested.}
{--create-recurring : Create recurring transactions. Other tasks will be skipped unless also requested.} {--create-recurring : Create recurring transactions. Other tasks will be skipped unless also requested.}
{--create-auto-budgets : Create auto budgets. Other tasks will be skipped unless also requested.} {--create-auto-budgets : Create auto budgets. Other tasks will be skipped unless also requested.}
{--send-bill-warnings : Send bill warnings. Other tasks will be skipped unless also requested.} {--send-subscription-warnings : Send subscription warnings. Other tasks will be skipped unless also requested.}
{--send-webhook-messages : Sends any stray webhook messages (with a maximum of 5).} {--send-webhook-messages : Sends any stray webhook messages (with a maximum of 5).}
'; ';
@@ -59,7 +59,7 @@ class Cron extends Command
$doAll = !$this->option('download-cer') $doAll = !$this->option('download-cer')
&& !$this->option('create-recurring') && !$this->option('create-recurring')
&& !$this->option('create-auto-budgets') && !$this->option('create-auto-budgets')
&& !$this->option('send-bill-warnings') && !$this->option('send-subscription-warnings')
&& !$this->option('check-version') && !$this->option('check-version')
&& !$this->option('send-webhook-messages'); && !$this->option('send-webhook-messages');
$date = null; $date = null;
@@ -116,9 +116,9 @@ class Cron extends Command
} }
// Fire bill warning cron job // Fire bill warning cron job
if ($doAll || $this->option('send-bill-warnings')) { if ($doAll || $this->option('send-subscription-warnings')) {
try { try {
$this->billWarningCronJob($force, $date); $this->subscriptionWarningCronJob($force, $date);
} catch (FireflyException $e) { } catch (FireflyException $e) {
app('log')->error($e->getMessage()); app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString()); app('log')->error($e->getTraceAsString());
@@ -231,25 +231,25 @@ class Cron extends Command
/** /**
* @throws FireflyException * @throws FireflyException
*/ */
private function billWarningCronJob(bool $force, ?Carbon $date): void private function subscriptionWarningCronJob(bool $force, ?Carbon $date): void
{ {
$autoBudget = new BillWarningCronjob(); $subscriptionWarningJob = new BillWarningCronjob();
$autoBudget->setForce($force); $subscriptionWarningJob->setForce($force);
// set date in cron job: // set date in cron job:
if ($date instanceof Carbon) { if ($date instanceof Carbon) {
$autoBudget->setDate($date); $subscriptionWarningJob->setDate($date);
} }
$autoBudget->fire(); $subscriptionWarningJob->fire();
if ($autoBudget->jobErrored) { if ($subscriptionWarningJob->jobErrored) {
$this->friendlyError(sprintf('Error in "bill warnings" cron: %s', $autoBudget->message)); $this->friendlyError(sprintf('Error in "subscription warnings" cron: %s', $subscriptionWarningJob->message));
} }
if ($autoBudget->jobFired) { if ($subscriptionWarningJob->jobFired) {
$this->friendlyInfo(sprintf('"Send bill warnings" cron fired: %s', $autoBudget->message)); $this->friendlyInfo(sprintf('"Send subscription warnings" cron fired: %s', $subscriptionWarningJob->message));
} }
if ($autoBudget->jobSucceeded) { if ($subscriptionWarningJob->jobSucceeded) {
$this->friendlyPositive(sprintf('"Send bill warnings" cron ran with success: %s', $autoBudget->message)); $this->friendlyPositive(sprintf('"Send subscription warnings" cron ran with success: %s', $subscriptionWarningJob->message));
} }
} }