Remove static references

This commit is contained in:
James Cole
2023-10-29 06:31:27 +01:00
parent 91b7d20f9b
commit e65d0eef6e
30 changed files with 80 additions and 80 deletions

View File

@@ -51,13 +51,13 @@ class BillWarningCronjob extends AbstractCronjob
$diffForHumans = today(config('app.timezone'))->diffForHumans(Carbon::createFromTimestamp($lastTime), null, true);
if (0 === $lastTime) {
Log::info('The bill warning cron-job has never fired before.');
app('log')->info('The bill warning cron-job has never fired before.');
}
// less than half a day ago:
if ($lastTime > 0 && $diff <= 43200) {
Log::info(sprintf('It has been %s since the bill warning cron-job has fired.', $diffForHumans));
app('log')->info(sprintf('It has been %s since the bill warning cron-job has fired.', $diffForHumans));
if (false === $this->force) {
Log::info('The cron-job will not fire now.');
app('log')->info('The cron-job will not fire now.');
$this->message = sprintf('It has been %s since the bill warning cron-job has fired. It will not fire now.', $diffForHumans);
$this->jobFired = false;
$this->jobErrored = false;
@@ -68,12 +68,12 @@ class BillWarningCronjob extends AbstractCronjob
// fire job regardless.
if (true === $this->force) {
Log::info('Execution of the bill warning cron-job has been FORCED.');
app('log')->info('Execution of the bill warning cron-job has been FORCED.');
}
}
if ($lastTime > 0 && $diff > 43200) {
Log::info(sprintf('It has been %s since the bill warning cron-job has fired. It will fire now!', $diffForHumans));
app('log')->info(sprintf('It has been %s since the bill warning cron-job has fired. It will fire now!', $diffForHumans));
}
$this->fireWarnings();
@@ -86,7 +86,7 @@ class BillWarningCronjob extends AbstractCronjob
*/
private function fireWarnings(): void
{
Log::info(sprintf('Will now fire bill warning job task for date "%s".', $this->date->format('Y-m-d H:i:s')));
app('log')->info(sprintf('Will now fire bill warning job task for date "%s".', $this->date->format('Y-m-d H:i:s')));
/** @var WarnAboutBills $job */
$job = app(WarnAboutBills::class);
$job->setDate($this->date);
@@ -100,7 +100,7 @@ class BillWarningCronjob extends AbstractCronjob
$this->message = 'Bill warning cron job fired successfully.';
app('fireflyconfig')->set('last_bw_job', (int)$this->date->format('U'));
Log::info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U')));
Log::info('Done with bill warning cron job task.');
app('log')->info(sprintf('Marked the last time this job has run as "%s" (%d)', $this->date->format('Y-m-d H:i:s'), (int)$this->date->format('U')));
app('log')->info('Done with bill warning cron job task.');
}
}