Remove static references

This commit is contained in:
James Cole
2023-10-29 06:33:43 +01:00
parent 075d459b7c
commit 4f2159b54d
205 changed files with 1287 additions and 1287 deletions

View File

@@ -51,13 +51,13 @@ class VersionCheckEventHandler
*/
public function checkForUpdates(RequestedVersionCheckStatus $event): void
{
Log::debug('Now in checkForUpdates()');
app('log')->debug('Now in checkForUpdates()');
// should not check for updates:
$permission = app('fireflyconfig')->get('permission_update_check', -1);
$value = (int)$permission->data;
if (1 !== $value) {
Log::debug('Update check is not enabled.');
app('log')->debug('Update check is not enabled.');
$this->warnToCheckForUpdates($event);
return;
@@ -67,7 +67,7 @@ class VersionCheckEventHandler
$repository = app(UserRepositoryInterface::class);
$user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
Log::debug('User is not admin, done.');
app('log')->debug('User is not admin, done.');
return;
}
@@ -76,14 +76,14 @@ class VersionCheckEventHandler
$lastCheckTime = app('fireflyconfig')->get('last_update_check', time());
$now = time();
$diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
app('log')->debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
if ($diff < 604800) {
Log::debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
app('log')->debug(sprintf('Checked for updates less than a week ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
return;
}
// last check time was more than a week ago.
Log::debug('Have not checked for a new version in a week!');
app('log')->debug('Have not checked for a new version in a week!');
$release = $this->getLatestRelease();
session()->flash($release['level'], $release['message']);
@@ -103,7 +103,7 @@ class VersionCheckEventHandler
$repository = app(UserRepositoryInterface::class);
$user = $event->user;
if (!$repository->hasRole($user, 'owner')) {
Log::debug('User is not admin, done.');
app('log')->debug('User is not admin, done.');
return;
}
@@ -112,14 +112,14 @@ class VersionCheckEventHandler
$lastCheckTime = app('fireflyconfig')->get('last_update_warning', time());
$now = time();
$diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
app('log')->debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
if ($diff < 604800 * 4) {
Log::debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
app('log')->debug(sprintf('Warned about updates less than four weeks ago (on %s).', date('Y-m-d H:i:s', $lastCheckTime->data)));
return;
}
// last check time was more than a week ago.
Log::debug('Have warned about a new version in four weeks!');
app('log')->debug('Have warned about a new version in four weeks!');
session()->flash('info', (string)trans('firefly.disabled_but_check'));
app('fireflyconfig')->set('last_update_warning', time());