mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Restore cron options.
This commit is contained in:
@@ -26,6 +26,8 @@ namespace FireflyIII\Support\Http\Controllers;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Support\Cronjobs\AutoBudgetCronjob;
|
||||
use FireflyIII\Support\Cronjobs\BillWarningCronjob;
|
||||
use FireflyIII\Support\Cronjobs\ExchangeRatesCronjob;
|
||||
use FireflyIII\Support\Cronjobs\RecurringCronjob;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
@@ -98,4 +100,70 @@ trait CronRunner
|
||||
'message' => $recurring->message,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bool $force
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function exchangeRatesCronJob(bool $force, Carbon $date): array
|
||||
{
|
||||
/** @var ExchangeRatesCronjob $exchangeRates */
|
||||
$exchangeRates = app(ExchangeRatesCronjob::class);
|
||||
$exchangeRates->setForce($force);
|
||||
$exchangeRates->setDate($date);
|
||||
try {
|
||||
$exchangeRates->fire();
|
||||
} catch (FireflyException $e) {
|
||||
return [
|
||||
'job_fired' => false,
|
||||
'job_succeeded' => false,
|
||||
'job_errored' => true,
|
||||
'message' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'job_fired' => $exchangeRates->jobFired,
|
||||
'job_succeeded' => $exchangeRates->jobSucceeded,
|
||||
'job_errored' => $exchangeRates->jobErrored,
|
||||
'message' => $exchangeRates->message,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param bool $force
|
||||
* @param Carbon $date
|
||||
*
|
||||
* @return array
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
protected function billWarningCronJob(bool $force, Carbon $date): array
|
||||
{
|
||||
/** @var BillWarningCronjob $billWarning */
|
||||
$billWarning = app(BillWarningCronjob::class);
|
||||
$billWarning->setForce($force);
|
||||
$billWarning->setDate($date);
|
||||
try {
|
||||
$billWarning->fire();
|
||||
} catch (FireflyException $e) {
|
||||
return [
|
||||
'job_fired' => false,
|
||||
'job_succeeded' => false,
|
||||
'job_errored' => true,
|
||||
'message' => $e->getMessage(),
|
||||
];
|
||||
}
|
||||
|
||||
return [
|
||||
'job_fired' => $billWarning->jobFired,
|
||||
'job_succeeded' => $billWarning->jobSucceeded,
|
||||
'job_errored' => $billWarning->jobErrored,
|
||||
'message' => $billWarning->message,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user