Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Remove some debug logging, use Facade.
James Coled91d30c8f0f1
diff --git a/app/Support/Authentication/RemoteUserGuard.php b/app/Support/Authentication/RemoteUserGuard.phpindex 1c87806e00..f53ecaa4fc 100644--- a/app/Support/Authentication/RemoteUserGuard.php+++ b/app/Support/Authentication/RemoteUserGuard.php@@ -49,14 +49,14 @@ class RemoteUserGuard implements Guard{/** @var null|Request $request */$request = $app->get('request');- Log::debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));+ // Log::debug(sprintf('Created RemoteUserGuard for %s "%s"', $request?->getMethod(), $request?->getRequestUri()));$this->application = $app;$this->user = null;}public function authenticate(): void{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));if ($this->user instanceof User) {Log::debug(sprintf('%s is found: #%d, "%s".', $this->user::class, $this->user->id, $this->user->email));@@ -104,21 +104,21 @@ class RemoteUserGuard implements Guardpublic function check(): bool{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));return $this->user() instanceof User;}public function guest(): bool{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));return !$this->check();}public function hasUser(): bool{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));throw new FireflyException('Did not implement RemoteUserGuard::hasUser()');}@@ -128,14 +128,14 @@ class RemoteUserGuard implements Guard*/public function id(): int|string|null{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));return $this->user?->id;}public function setUser(Authenticatable|User|null $user): void // @phpstan-ignore-line{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));if ($user instanceof User) {$this->user = $user;@@ -146,7 +146,7 @@ class RemoteUserGuard implements Guardpublic function user(): ?User{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));$user = $this->user;if (!$user instanceof User) {Log::debug('User is NULL');@@ -164,14 +164,14 @@ class RemoteUserGuard implements Guard*/public function validate(array $credentials = []): bool{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));throw new FireflyException('Did not implement RemoteUserGuard::validate()');}public function viaRemember(): bool{- Log::debug(sprintf('Now at %s', __METHOD__));+ // Log::debug(sprintf('Now at %s', __METHOD__));return false;}diff --git a/app/Support/System/OAuthKeys.php b/app/Support/System/OAuthKeys.phpindex afb028180a..0f66372a69 100644--- a/app/Support/System/OAuthKeys.php+++ b/app/Support/System/OAuthKeys.php@@ -25,6 +25,7 @@ declare(strict_types=1);namespace FireflyIII\Support\System;use FireflyIII\Exceptions\FireflyException;+use FireflyIII\Support\Facades\FireflyConfig;use Illuminate\Contracts\Encryption\DecryptException;use Illuminate\Support\Facades\Artisan;use Illuminate\Support\Facades\Crypt;@@ -63,10 +64,10 @@ class OAuthKeys$privateKey = '';$publicKey = '';// better check if keys are in the database:- if (app('fireflyconfig')->has(self::PRIVATE_KEY) && app('fireflyconfig')->has(self::PUBLIC_KEY)) {+ if (FireflyConfig::has(self::PRIVATE_KEY) && FireflyConfig::has(self::PUBLIC_KEY)) {try {- $privateKey = (string)app('fireflyconfig')->get(self::PRIVATE_KEY)?->data;- $publicKey = (string)app('fireflyconfig')->get(self::PUBLIC_KEY)?->data;+ $privateKey = (string)FireflyConfig::get(self::PRIVATE_KEY)?->data;+ $publicKey = (string)FireflyConfig::get(self::PUBLIC_KEY)?->data;} catch (ContainerExceptionInterface|FireflyException|NotFoundExceptionInterface $e) {app('log')->error(sprintf('Could not validate keysInDatabase(): %s', $e->getMessage()));app('log')->error($e->getTraceAsString());@@ -87,8 +88,8 @@ class OAuthKeys*/public static function restoreKeysFromDB(): bool{- $privateKey = (string)app('fireflyconfig')->get(self::PRIVATE_KEY)?->data;- $publicKey = (string)app('fireflyconfig')->get(self::PUBLIC_KEY)?->data;+ $privateKey = (string)FireflyConfig::get(self::PRIVATE_KEY)?->data;+ $publicKey = (string)FireflyConfig::get(self::PUBLIC_KEY)?->data;try {$privateContent = Crypt::decrypt($privateKey);@@ -98,8 +99,8 @@ class OAuthKeysapp('log')->error($e->getMessage());// delete config vars from DB:- app('fireflyconfig')->delete(self::PRIVATE_KEY);- app('fireflyconfig')->delete(self::PUBLIC_KEY);+ FireflyConfig::delete(self::PRIVATE_KEY);+ FireflyConfig::delete(self::PUBLIC_KEY);return false;}@@ -115,8 +116,8 @@ class OAuthKeys{$private = storage_path('oauth-private.key');$public = storage_path('oauth-public.key');- app('fireflyconfig')->set(self::PRIVATE_KEY, Crypt::encrypt(file_get_contents($private)));- app('fireflyconfig')->set(self::PUBLIC_KEY, Crypt::encrypt(file_get_contents($public)));+ FireflyConfig::set(self::PRIVATE_KEY, Crypt::encrypt(file_get_contents($private)));+ FireflyConfig::set(self::PUBLIC_KEY, Crypt::encrypt(file_get_contents($public)));}public static function verifyKeysRoutine(): void