Replace config calls.

This commit is contained in:
James Cole
2025-12-20 06:42:11 +01:00
parent b0cc5f3a46
commit 0f0cdb8e96
42 changed files with 90 additions and 89 deletions

View File

@@ -107,8 +107,8 @@ class VerifySecurityAlerts extends Command
private function removeOldAdvisory(): void private function removeOldAdvisory(): void
{ {
try { try {
app('fireflyconfig')->delete('upgrade_security_message'); \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_message');
app('fireflyconfig')->delete('upgrade_security_level'); \FireflyIII\Support\Facades\FireflyConfig::delete('upgrade_security_level');
} catch (QueryException $e) { } catch (QueryException $e) {
Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage())); Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
} }
@@ -117,8 +117,8 @@ class VerifySecurityAlerts extends Command
private function saveSecurityAdvisory(array $array): void private function saveSecurityAdvisory(array $array): void
{ {
try { try {
app('fireflyconfig')->set('upgrade_security_message', $array['message']); \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_message', $array['message']);
app('fireflyconfig')->set('upgrade_security_level', $array['level']); \FireflyIII\Support\Facades\FireflyConfig::set('upgrade_security_level', $array['level']);
} catch (QueryException $e) { } catch (QueryException $e) {
Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage())); Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
} }

View File

@@ -97,7 +97,7 @@ class AddsTransactionIdentifiers extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -157,6 +157,6 @@ class AddsTransactionIdentifiers extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -86,7 +86,7 @@ class RemovesDatabaseDecryption extends Command
$this->friendlyPositive(sprintf('Decrypted the data in table "%s".', $table)); $this->friendlyPositive(sprintf('Decrypted the data in table "%s".', $table));
// mark as decrypted: // mark as decrypted:
$configName = sprintf('is_decrypted_%s', $table); $configName = sprintf('is_decrypted_%s', $table);
app('fireflyconfig')->set($configName, true); \FireflyIII\Support\Facades\FireflyConfig::set($configName, true);
} }
private function isDecrypted(string $table): bool private function isDecrypted(string $table): bool
@@ -95,7 +95,7 @@ class RemovesDatabaseDecryption extends Command
$configVar = null; $configVar = null;
try { try {
$configVar = app('fireflyconfig')->get($configName, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get($configName, false);
} catch (FireflyException $e) { } catch (FireflyException $e) {
Log::error($e->getMessage()); Log::error($e->getMessage());
} }

View File

@@ -58,14 +58,14 @@ class RepairsAccountBalances extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool) $configVar?->data; return (bool) $configVar?->data;
} }
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
private function correctBalanceAmounts(): void private function correctBalanceAmounts(): void

View File

@@ -41,7 +41,7 @@ class UpgradeSkeleton extends Command
*/ */
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
if (null !== $configVar) { if (null !== $configVar) {
return (bool)$configVar->data; return (bool)$configVar->data;
} }
@@ -55,6 +55,6 @@ class UpgradeSkeleton extends Command
*/ */
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -85,7 +85,7 @@ class UpgradesAccountCurrencies extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool) $configVar?->data; return (bool) $configVar?->data;
} }
@@ -155,6 +155,6 @@ class UpgradesAccountCurrencies extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -82,7 +82,7 @@ class UpgradesAccountMetaData extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -90,6 +90,6 @@ class UpgradesAccountMetaData extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -92,7 +92,7 @@ class UpgradesAttachments extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -100,6 +100,6 @@ class UpgradesAttachments extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -99,7 +99,7 @@ class UpgradesBillsToRules extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -206,6 +206,6 @@ class UpgradesBillsToRules extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -58,7 +58,7 @@ class UpgradesBudgetLimitPeriods extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool) $configVar->data; return (bool) $configVar->data;
} }
@@ -152,6 +152,6 @@ class UpgradesBudgetLimitPeriods extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -84,7 +84,7 @@ class UpgradesBudgetLimits extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -92,6 +92,6 @@ class UpgradesBudgetLimits extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -80,13 +80,13 @@ class UpgradesCreditCardLiabilities extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool) $configVar?->data; return (bool) $configVar?->data;
} }
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -65,7 +65,7 @@ class UpgradesCurrencyPreferences extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -144,6 +144,6 @@ class UpgradesCurrencyPreferences extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -69,14 +69,14 @@ class UpgradesJournalMetaData extends Command
private function isMigrated(): bool private function isMigrated(): bool
{ {
$configVar = app('fireflyconfig')->get(UpgradesToGroups::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(UpgradesToGroups::CONFIG_NAME, false);
return (bool) $configVar->data; return (bool) $configVar->data;
} }
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool) $configVar->data; return (bool) $configVar->data;
} }
@@ -218,6 +218,6 @@ class UpgradesJournalMetaData extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -86,7 +86,7 @@ class UpgradesJournalNotes extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -94,6 +94,6 @@ class UpgradesJournalNotes extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -61,7 +61,7 @@ class UpgradesLiabilities extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -148,6 +148,6 @@ class UpgradesLiabilities extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -63,7 +63,7 @@ class UpgradesLiabilitiesEight extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -207,6 +207,6 @@ class UpgradesLiabilitiesEight extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -64,7 +64,7 @@ class UpgradesMultiPiggyBanks extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -112,6 +112,6 @@ class UpgradesMultiPiggyBanks extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -60,7 +60,7 @@ class UpgradesPrimaryCurrencyAmounts extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -68,6 +68,6 @@ class UpgradesPrimaryCurrencyAmounts extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -65,7 +65,7 @@ class UpgradesRecurrenceMetaData extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -117,6 +117,6 @@ class UpgradesRecurrenceMetaData extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -63,7 +63,7 @@ class UpgradesRuleActions extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -183,6 +183,6 @@ class UpgradesRuleActions extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -57,7 +57,7 @@ class UpgradesTagLocations extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -97,6 +97,6 @@ class UpgradesTagLocations extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -97,7 +97,7 @@ class UpgradesToGroups extends Command
private function isMigrated(): bool private function isMigrated(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -379,6 +379,6 @@ class UpgradesToGroups extends Command
private function markAsMigrated(): void private function markAsMigrated(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -105,7 +105,7 @@ class UpgradesTransferCurrencies extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -480,6 +480,6 @@ class UpgradesTransferCurrencies extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -86,7 +86,7 @@ class UpgradesVariousCurrencyInformation extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -246,6 +246,6 @@ class UpgradesVariousCurrencyInformation extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -63,7 +63,7 @@ class UpgradesWebhooks extends Command
private function isExecuted(): bool private function isExecuted(): bool
{ {
$configVar = app('fireflyconfig')->get(self::CONFIG_NAME, false); $configVar = \FireflyIII\Support\Facades\FireflyConfig::get(self::CONFIG_NAME, false);
return (bool)$configVar?->data; return (bool)$configVar?->data;
@@ -109,6 +109,6 @@ class UpgradesWebhooks extends Command
private function markAsExecuted(): void private function markAsExecuted(): void
{ {
app('fireflyconfig')->set(self::CONFIG_NAME, true); \FireflyIII\Support\Facades\FireflyConfig::set(self::CONFIG_NAME, true);
} }
} }

View File

@@ -45,7 +45,7 @@ class AdminEventHandler
{ {
public function sendInvitationNotification(InvitationCreated $event): void public function sendInvitationNotification(InvitationCreated $event): void
{ {
$sendMail = app('fireflyconfig')->get('notification_invite_created', true)->data; $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_invite_created', true)->data;
if (false === $sendMail) { if (false === $sendMail) {
return; return;
} }
@@ -96,7 +96,7 @@ class AdminEventHandler
*/ */
public function sendNewVersion(NewVersionAvailable $event): void public function sendNewVersion(NewVersionAvailable $event): void
{ {
$sendMail = app('fireflyconfig')->get('notification_new_version', true)->data; $sendMail = \FireflyIII\Support\Facades\FireflyConfig::get('notification_new_version', true)->data;
if (false === $sendMail) { if (false === $sendMail) {
return; return;
} }

View File

@@ -224,7 +224,7 @@ class UserEventHandler
public function sendAdminRegistrationNotification(RegisteredUser $event): void public function sendAdminRegistrationNotification(RegisteredUser $event): void
{ {
$sendMail = (bool)app('fireflyconfig')->get('notification_admin_new_reg', true)->data; $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_admin_new_reg', true)->data;
if ($sendMail) { if ($sendMail) {
$owner = $event->owner; $owner = $event->owner;
@@ -367,7 +367,7 @@ class UserEventHandler
*/ */
public function sendRegistrationMail(RegisteredUser $event): void public function sendRegistrationMail(RegisteredUser $event): void
{ {
$sendMail = (bool)app('fireflyconfig')->get('notification_user_new_reg', true)->data; $sendMail = (bool)\FireflyIII\Support\Facades\FireflyConfig::get('notification_user_new_reg', true)->data;
if ($sendMail) { if ($sendMail) {
try { try {
Notification::send($event->user, new UserRegistrationNotification()); Notification::send($event->user, new UserRegistrationNotification());

View File

@@ -54,7 +54,7 @@ class VersionCheckEventHandler
Log::debug('Now in checkForUpdates()'); Log::debug('Now in checkForUpdates()');
// should not check for updates: // should not check for updates:
$permission = app('fireflyconfig')->get('permission_update_check', -1); $permission = \FireflyIII\Support\Facades\FireflyConfig::get('permission_update_check', -1);
$value = (int) $permission->data; $value = (int) $permission->data;
if (1 !== $value) { if (1 !== $value) {
Log::debug('Update check is not enabled.'); Log::debug('Update check is not enabled.');
@@ -73,7 +73,7 @@ class VersionCheckEventHandler
} }
/** @var Configuration $lastCheckTime */ /** @var Configuration $lastCheckTime */
$lastCheckTime = app('fireflyconfig')->get('last_update_check', Carbon::now()->getTimestamp()); $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_check', Carbon::now()->getTimestamp());
$now = Carbon::now()->getTimestamp(); $now = Carbon::now()->getTimestamp();
$diff = $now - $lastCheckTime->data; $diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); Log::debug(sprintf('Last check time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
@@ -87,7 +87,7 @@ class VersionCheckEventHandler
$release = $this->getLatestRelease(); $release = $this->getLatestRelease();
session()->flash($release['level'], $release['message']); session()->flash($release['level'], $release['message']);
app('fireflyconfig')->set('last_update_check', Carbon::now()->getTimestamp()); \FireflyIII\Support\Facades\FireflyConfig::set('last_update_check', Carbon::now()->getTimestamp());
} }
/** /**
@@ -107,7 +107,7 @@ class VersionCheckEventHandler
} }
/** @var Configuration $lastCheckTime */ /** @var Configuration $lastCheckTime */
$lastCheckTime = app('fireflyconfig')->get('last_update_warning', Carbon::now()->getTimestamp()); $lastCheckTime = \FireflyIII\Support\Facades\FireflyConfig::get('last_update_warning', Carbon::now()->getTimestamp());
$now = Carbon::now()->getTimestamp(); $now = Carbon::now()->getTimestamp();
$diff = $now - $lastCheckTime->data; $diff = $now - $lastCheckTime->data;
Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff)); Log::debug(sprintf('Last warning time is %d, current time is %d, difference is %d', $lastCheckTime->data, $now, $diff));
@@ -120,6 +120,6 @@ class VersionCheckEventHandler
Log::debug('Have warned about a new version in four weeks!'); Log::debug('Have warned about a new version in four weeks!');
session()->flash('info', (string) trans('firefly.disabled_but_check')); session()->flash('info', (string) trans('firefly.disabled_but_check'));
app('fireflyconfig')->set('last_update_warning', Carbon::now()->getTimestamp()); \FireflyIII\Support\Facades\FireflyConfig::set('last_update_warning', Carbon::now()->getTimestamp());
} }
} }

View File

@@ -43,7 +43,7 @@ trait UpdateTrait
/** @var UpdateRequestInterface $checker */ /** @var UpdateRequestInterface $checker */
$checker = app(UpdateRequestInterface::class); $checker = app(UpdateRequestInterface::class);
$channelConfig = app('fireflyconfig')->get('update_channel', 'stable'); $channelConfig = \FireflyIII\Support\Facades\FireflyConfig::get('update_channel', 'stable');
$channel = (string) $channelConfig->data; $channel = (string) $channelConfig->data;
return $checker->getUpdateInformation($channel); return $checker->getUpdateInformation($channel);

View File

@@ -164,7 +164,7 @@ class UserController extends Controller
$subTitle = (string) trans('firefly.user_administration'); $subTitle = (string) trans('firefly.user_administration');
$subTitleIcon = 'fa-users'; $subTitleIcon = 'fa-users';
$users = $this->repository->all(); $users = $this->repository->all();
$singleUserMode = (bool) app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = (bool) \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$allowInvites = false; $allowInvites = false;
if (!$this->externalIdentity && $singleUserMode) { if (!$this->externalIdentity && $singleUserMode) {
// also registration enabled. // also registration enabled.

View File

@@ -142,7 +142,7 @@ class ForgotPasswordController extends Controller
} }
// is allowed to? // is allowed to?
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();
$allowRegistration = true; $allowRegistration = true;
$pageTitle = (string) trans('firefly.forgot_pw_page_title'); $pageTitle = (string) trans('firefly.forgot_pw_page_title');

View File

@@ -236,7 +236,7 @@ class LoginController extends Controller
} }
// is allowed to register, etc. // is allowed to register, etc.
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$allowRegistration = true; $allowRegistration = true;
$allowReset = true; $allowReset = true;
if (true === $singleUserMode && $count > 0) { if (true === $singleUserMode && $count > 0) {

View File

@@ -121,7 +121,7 @@ class RegisterController extends Controller
$allowRegistration = true; $allowRegistration = true;
try { try {
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
} catch (ContainerExceptionInterface|NotFoundExceptionInterface) { } catch (ContainerExceptionInterface|NotFoundExceptionInterface) {
$singleUserMode = true; $singleUserMode = true;
} }
@@ -148,7 +148,7 @@ class RegisterController extends Controller
*/ */
public function showInviteForm(Request $request, string $code): Factory|\Illuminate\Contracts\View\View public function showInviteForm(Request $request, string $code): Factory|\Illuminate\Contracts\View\View
{ {
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$pageTitle = (string) trans('firefly.register_page_title'); $pageTitle = (string) trans('firefly.register_page_title');
$repository = app(UserRepositoryInterface::class); $repository = app(UserRepositoryInterface::class);
$allowRegistration = $this->allowedToRegister(); $allowRegistration = $this->allowedToRegister();
@@ -182,7 +182,7 @@ class RegisterController extends Controller
*/ */
public function showRegistrationForm(?Request $request = null): Factory|\Illuminate\Contracts\View\View public function showRegistrationForm(?Request $request = null): Factory|\Illuminate\Contracts\View\View
{ {
$isDemoSite = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site'))->data; $isDemoSite = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site'))->data;
$pageTitle = (string) trans('firefly.register_page_title'); $pageTitle = (string) trans('firefly.register_page_title');
$allowRegistration = $this->allowedToRegister(); $allowRegistration = $this->allowedToRegister();

View File

@@ -131,7 +131,7 @@ class ResetPasswordController extends Controller
} }
// is allowed to register? // is allowed to register?
$singleUserMode = app('fireflyconfig')->get('single_user_mode', config('firefly.configuration.single_user_mode'))->data; $singleUserMode = \FireflyIII\Support\Facades\FireflyConfig::get('single_user_mode', config('firefly.configuration.single_user_mode'))->data;
$userCount = User::count(); $userCount = User::count();
$allowRegistration = true; $allowRegistration = true;
$pageTitle = (string) trans('firefly.reset_pw_page_title'); $pageTitle = (string) trans('firefly.reset_pw_page_title');

View File

@@ -71,7 +71,7 @@ abstract class Controller extends BaseController
public function __construct() public function __construct()
{ {
// is site a demo site? // is site a demo site?
$isDemoSiteConfig = app('fireflyconfig')->get('is_demo_site', config('firefly.configuration.is_demo_site', false)); $isDemoSiteConfig = \FireflyIII\Support\Facades\FireflyConfig::get('is_demo_site', config('firefly.configuration.is_demo_site', false));
$isDemoSite = (bool) $isDemoSiteConfig->data; $isDemoSite = (bool) $isDemoSiteConfig->data;
View::share('IS_DEMO_SITE', $isDemoSite); View::share('IS_DEMO_SITE', $isDemoSite);
View::share('DEMO_USERNAME', config('firefly.demo_username')); View::share('DEMO_USERNAME', config('firefly.demo_username'));

View File

@@ -241,7 +241,7 @@ class DebugController extends Controller
{ {
$userGuard = config('auth.defaults.guard'); $userGuard = config('auth.defaults.guard');
$config = app('fireflyconfig')->get('last_rt_job', 0); $config = \FireflyIII\Support\Facades\FireflyConfig::get('last_rt_job', 0);
$lastTime = (int) $config->data; $lastTime = (int) $config->data;
$lastCronjob = 'never'; $lastCronjob = 'never';
$lastCronjobAgo = 'never'; $lastCronjobAgo = 'never';

View File

@@ -144,11 +144,11 @@ class Range
// share security message: // share security message:
if ( if (
app('fireflyconfig')->has('upgrade_security_message') \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_message')
&& app('fireflyconfig')->has('upgrade_security_level') && \FireflyIII\Support\Facades\FireflyConfig::has('upgrade_security_level')
) { ) {
app('view')->share('upgrade_security_message', app('fireflyconfig')->get('upgrade_security_message')->data); app('view')->share('upgrade_security_message', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_message')->data);
app('view')->share('upgrade_security_level', app('fireflyconfig')->get('upgrade_security_level')->data); app('view')->share('upgrade_security_level', \FireflyIII\Support\Facades\FireflyConfig::get('upgrade_security_level')->data);
} }
} }
} }

View File

@@ -58,8 +58,8 @@ class OwnerNotifiable
public function routeNotificationForPushover(): PushoverReceiver public function routeNotificationForPushover(): PushoverReceiver
{ {
Log::debug('Return settings for routeNotificationForPushover'); Log::debug('Return settings for routeNotificationForPushover');
$pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data;
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data; $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data;
return PushoverReceiver::withUserKey($pushoverUserToken) return PushoverReceiver::withUserKey($pushoverUserToken)
->withApplicationToken($pushoverAppToken) ->withApplicationToken($pushoverAppToken)
@@ -68,7 +68,7 @@ class OwnerNotifiable
public function routeNotificationForSlack(): string public function routeNotificationForSlack(): string
{ {
$res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data;
if (is_array($res)) { if (is_array($res)) {
$res = ''; $res = '';
} }

View File

@@ -54,7 +54,7 @@ class ReturnsAvailableChannels
$channels = ['mail']; $channels = ['mail'];
if (true === config('notifications.channels.slack.enabled', false)) { if (true === config('notifications.channels.slack.enabled', false)) {
$slackUrl = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; $slackUrl = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data;
if (UrlValidator::isValidWebhookURL($slackUrl)) { if (UrlValidator::isValidWebhookURL($slackUrl)) {
$channels[] = 'slack'; $channels[] = 'slack';
} }
@@ -62,19 +62,19 @@ class ReturnsAvailableChannels
// if (true === config('notifications.channels.ntfy.enabled', false)) { // if (true === config('notifications.channels.ntfy.enabled', false)) {
// // validate presence of of Ntfy settings. // // validate presence of of Ntfy settings.
// if ('' !== (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) { // if ('' !== (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('ntfy_topic', '')->data) {
// Log::debug('Enabled ntfy.'); // Log::debug('Enabled ntfy.');
// $channels[] = NtfyChannel::class; // $channels[] = NtfyChannel::class;
// } // }
// if ('' === (string) app('fireflyconfig')->getEncrypted('ntfy_topic', '')->data) { // if ('' === (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('ntfy_topic', '')->data) {
// Log::warning('No topic name for Ntfy, channel is disabled.'); // Log::warning('No topic name for Ntfy, channel is disabled.');
// } // }
// } // }
// pushover // pushover
if (true === config('notifications.channels.pushover.enabled', false)) { if (true === config('notifications.channels.pushover.enabled', false)) {
$pushoverAppToken = (string) app('fireflyconfig')->getEncrypted('pushover_app_token', '')->data; $pushoverAppToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_app_token', '')->data;
$pushoverUserToken = (string) app('fireflyconfig')->getEncrypted('pushover_user_token', '')->data; $pushoverUserToken = (string) \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('pushover_user_token', '')->data;
if ('' === $pushoverAppToken || '' === $pushoverUserToken) { if ('' === $pushoverAppToken || '' === $pushoverUserToken) {
Log::warning('[b] No Pushover token, channel is disabled.'); Log::warning('[b] No Pushover token, channel is disabled.');
} }

View File

@@ -36,7 +36,7 @@ trait GeneratesInstallationId
protected function generateInstallationId(): void protected function generateInstallationId(): void
{ {
try { try {
$config = app('fireflyconfig')->get('installation_id'); $config = \FireflyIII\Support\Facades\FireflyConfig::get('installation_id');
} catch (FireflyException) { } catch (FireflyException) {
Log::info('Could not create or generate installation ID. Do not continue.'); Log::info('Could not create or generate installation ID. Do not continue.');
@@ -52,7 +52,7 @@ trait GeneratesInstallationId
$uuid4 = Uuid::uuid4(); $uuid4 = Uuid::uuid4();
$uniqueId = (string)$uuid4; $uniqueId = (string)$uuid4;
Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId)); Log::info(sprintf('Created Firefly III installation ID %s', $uniqueId));
app('fireflyconfig')->set('installation_id', $uniqueId); \FireflyIII\Support\Facades\FireflyConfig::set('installation_id', $uniqueId);
} }
} }
} }

View File

@@ -24,6 +24,7 @@ declare(strict_types=1);
namespace FireflyIII; namespace FireflyIII;
use FireflyIII\Support\Facades\FireflyConfig;
use FireflyIII\Support\Facades\Preferences; use FireflyIII\Support\Facades\Preferences;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Deprecated; use Deprecated;
@@ -403,7 +404,7 @@ class User extends Authenticatable
public function routeNotificationForSlack(Notification $notification): ?string public function routeNotificationForSlack(Notification $notification): ?string
{ {
// this check does not validate if the user is owner, Should be done by notification itself. // this check does not validate if the user is owner, Should be done by notification itself.
$res = app('fireflyconfig')->getEncrypted('slack_webhook_url', '')->data; $res = \FireflyIII\Support\Facades\FireflyConfig::getEncrypted('slack_webhook_url', '')->data;
if (is_array($res)) { if (is_array($res)) {
$res = ''; $res = '';
} }