Firefly III: a personal finances manager
PHP accountingbudgetbudgetingbudgetscash-flowcashflowcredit-carddockerexpensesfinancefinancesfinanciallinuxmoneypaycheckpersonal-financephpphp7
Remove static references
James Cole91b7d20f9b08
diff --git a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.phpindex ccd8e4721b..0309e53898 100644--- a/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php+++ b/app/Console/Commands/Upgrade/UpgradeLiabilitiesEight.php@@ -216,7 +216,7 @@ class UpgradeLiabilitiesEight extends Commandreturn;}- Log::warning('Did not find opening balance.');+ app('log')->warning('Did not find opening balance.');}/**diff --git a/app/Handlers/Events/APIEventHandler.php b/app/Handlers/Events/APIEventHandler.phpindex c1d78be08e..2938bdc1f5 100644--- a/app/Handlers/Events/APIEventHandler.php+++ b/app/Handlers/Events/APIEventHandler.php@@ -54,11 +54,11 @@ class APIEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Handlers/Events/AdminEventHandler.php b/app/Handlers/Events/AdminEventHandler.phpindex acf73ff5a4..0bcb9b264a 100644--- a/app/Handlers/Events/AdminEventHandler.php+++ b/app/Handlers/Events/AdminEventHandler.php@@ -62,11 +62,11 @@ class AdminEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());@@ -100,11 +100,11 @@ class AdminEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());@@ -134,11 +134,11 @@ class AdminEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Handlers/Events/AutomationHandler.php b/app/Handlers/Events/AutomationHandler.phpindex defb50f90f..4b761f92a7 100644--- a/app/Handlers/Events/AutomationHandler.php+++ b/app/Handlers/Events/AutomationHandler.php@@ -78,11 +78,11 @@ class AutomationHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Handlers/Events/BillEventHandler.php b/app/Handlers/Events/BillEventHandler.phpindex a7b58a4102..d3e5f99017 100644--- a/app/Handlers/Events/BillEventHandler.php+++ b/app/Handlers/Events/BillEventHandler.php@@ -56,11 +56,11 @@ class BillEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Handlers/Events/Model/BudgetLimitHandler.php b/app/Handlers/Events/Model/BudgetLimitHandler.phpindex 8abe31998a..7bf72ba2fe 100644--- a/app/Handlers/Events/Model/BudgetLimitHandler.php+++ b/app/Handlers/Events/Model/BudgetLimitHandler.php@@ -65,11 +65,11 @@ class BudgetLimitHandlerLog::debug(sprintf('Now in updateAvailableBudget(#%d)', $budgetLimit->id));$budget = Budget::find($budgetLimit->budget_id);if (null === $budget) {- Log::warning('Budget is null, probably deleted, find deleted version.');+ app('log')->warning('Budget is null, probably deleted, find deleted version.');$budget = Budget::withTrashed()->find($budgetLimit->budget_id);}if (null === $budget) {- Log::warning('Budget is still null, cannot continue, will delete budget limit.');+ app('log')->warning('Budget is still null, cannot continue, will delete budget limit.');$budgetLimit->forceDelete();return;}@@ -77,7 +77,7 @@ class BudgetLimitHandler// sanity check. It happens when the budget has been deleted so the original user is unknown.if (null === $user) {- Log::warning('User is null, cannot continue.');+ app('log')->warning('User is null, cannot continue.');$budgetLimit->forceDelete();return;}diff --git a/app/Handlers/Events/Model/PiggyBankEventHandler.php b/app/Handlers/Events/Model/PiggyBankEventHandler.phpindex 5eca00f652..fa1ec5a4c4 100644--- a/app/Handlers/Events/Model/PiggyBankEventHandler.php+++ b/app/Handlers/Events/Model/PiggyBankEventHandler.php@@ -52,7 +52,7 @@ class PiggyBankEventHandler->where('transaction_journal_id', $journal->id)->exists();if ($exists) {- Log::warning('Already have event for this journal and piggy, will not create another.');+ app('log')->warning('Already have event for this journal and piggy, will not create another.');return;}}diff --git a/app/Handlers/Events/UserEventHandler.php b/app/Handlers/Events/UserEventHandler.phpindex 6f534d04a1..79beb3405f 100644--- a/app/Handlers/Events/UserEventHandler.php+++ b/app/Handlers/Events/UserEventHandler.php@@ -207,11 +207,11 @@ class UserEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());@@ -241,11 +241,11 @@ class UserEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());@@ -318,11 +318,11 @@ class UserEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());@@ -366,11 +366,11 @@ class UserEventHandler} catch (Exception $e) {$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not send notification. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Http/Controllers/DebugController.php b/app/Http/Controllers/DebugController.phpindex c4fc690fe1..ee03dab98e 100644--- a/app/Http/Controllers/DebugController.php+++ b/app/Http/Controllers/DebugController.php@@ -203,7 +203,7 @@ class DebugController extends Controller}} catch (Exception $e) { // generic catch for open basedir.Log::debug('Could not check build counter, but thats ok.');- Log::warning($e->getMessage());+ app('log')->warning($e->getMessage());}try {if (file_exists('/var/www/build-date-main.txt')) {@@ -211,7 +211,7 @@ class DebugController extends Controller}} catch (Exception $e) { // generic catch for open basedir.Log::debug('Could not check build date, but thats ok.');- Log::warning($e->getMessage());+ app('log')->warning($e->getMessage());}if ('' !== (string)env('BASE_IMAGE_BUILD')) {$return['base_build'] = env('BASE_IMAGE_BUILD');diff --git a/app/Http/Middleware/Authenticate.php b/app/Http/Middleware/Authenticate.phpindex 476ceabe80..b0e3e4f743 100644--- a/app/Http/Middleware/Authenticate.php+++ b/app/Http/Middleware/Authenticate.php@@ -128,7 +128,7 @@ class Authenticateprivate function validateBlockedUser(?User $user, array $guards): void{if (null === $user) {- Log::warning('User is null, throw exception?');+ app('log')->warning('User is null, throw exception?');}if (null !== $user) {// Log::debug(get_class($user));@@ -137,7 +137,7 @@ class Authenticateif ('email_changed' === $user->blocked_code) {$message = (string)trans('firefly.email_changed_logout');}- Log::warning('User is blocked, cannot use authentication method.');+ app('log')->warning('User is blocked, cannot use authentication method.');app('session')->flash('logoutMessage', $message);/** @noinspection PhpUndefinedMethodInspection */$this->auth->logout(); // @phpstan-ignore-line (thinks function is undefined)diff --git a/app/Jobs/MailError.php b/app/Jobs/MailError.phpindex bb4b916b7d..4f235ea29e 100644--- a/app/Jobs/MailError.php+++ b/app/Jobs/MailError.php@@ -95,11 +95,11 @@ class MailError extends Job implements ShouldQueue} catch (Exception | TransportException $e) { // intentional generic exception$message = $e->getMessage();if (str_contains($message, 'Bcc')) {- Log::warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[Bcc] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');return;}if (str_contains($message, 'RFC 2822')) {- Log::warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');+ app('log')->warning('[RFC] Could not email or log the error. Please validate your email settings, use the .env.example file as a guide.');return;}Log::error($e->getMessage());diff --git a/app/Services/Internal/Support/CreditRecalculateService.php b/app/Services/Internal/Support/CreditRecalculateService.phpindex c221ab4131..58f81795e2 100644--- a/app/Services/Internal/Support/CreditRecalculateService.php+++ b/app/Services/Internal/Support/CreditRecalculateService.php@@ -433,7 +433,7 @@ class CreditRecalculateServicereturn $result;}- Log::warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, $decimals)));+ app('log')->warning(sprintf('[-1] Catch-all, should not happen. Left of debt = %s', app('steam')->bcround($leftOfDebt, $decimals)));return $leftOfDebt;}diff --git a/app/Services/Internal/Update/RecurrenceUpdateService.php b/app/Services/Internal/Update/RecurrenceUpdateService.phpindex 559f333fd3..926882e621 100644--- a/app/Services/Internal/Update/RecurrenceUpdateService.php+++ b/app/Services/Internal/Update/RecurrenceUpdateService.php@@ -224,7 +224,7 @@ class RecurrenceUpdateServiceLog::debug(sprintf('Original count is %d', $originalCount));if (0 === count($transactions)) {// won't drop transactions, rather avoid.- Log::warning('No transactions to update, too scared to continue!');+ app('log')->warning('No transactions to update, too scared to continue!');return;}$combinations = [];diff --git a/app/Support/Navigation.php b/app/Support/Navigation.phpindex fbd3e3a0ab..77b451691f 100644--- a/app/Support/Navigation.php+++ b/app/Support/Navigation.php@@ -111,7 +111,7 @@ class Navigationtry {return $this->calculator->nextDateByInterval($epoch, $periodicity, $skipInterval);} catch (IntervalException $exception) {- Log::warning($exception->getMessage(), ['exception' => $exception]);+ app('log')->warning($exception->getMessage(), ['exception' => $exception]);} catch (Throwable $exception) {Log::error($exception->getMessage(), ['exception' => $exception]);}diff --git a/app/Validation/RecurrenceValidation.php b/app/Validation/RecurrenceValidation.phpindex 6dabcbf60d..d87a7656be 100644--- a/app/Validation/RecurrenceValidation.php+++ b/app/Validation/RecurrenceValidation.php@@ -340,12 +340,12 @@ trait RecurrenceValidation//$recurrence = $validator->getif (null === $transactions) {- Log::warning('[a] User submitted no transactions.');+ app('log')->warning('[a] User submitted no transactions.');$validator->errors()->add('transactions', (string)trans('validation.at_least_one_transaction'));return;}if (0 === $submittedTrCount) {- Log::warning('[b] User submitted no transactions.');+ app('log')->warning('[b] User submitted no transactions.');$validator->errors()->add('transactions', (string)trans('validation.at_least_one_transaction'));return;}@@ -393,12 +393,12 @@ trait RecurrenceValidationforeach ($transactions as $index => $transaction) {Log::debug(sprintf('Now at %d/%d', $index + 1, $submittedTrCount));if (!is_array($transaction)) {- Log::warning('Not an array. Give error.');+ app('log')->warning('Not an array. Give error.');$validator->errors()->add(sprintf('transactions.%d.id', $index), (string)trans('validation.at_least_one_transaction'));return;}if (!array_key_exists('id', $transaction) && $idsMandatory) {- Log::warning('ID is mandatory but array has no ID.');+ app('log')->warning('ID is mandatory but array has no ID.');$validator->errors()->add(sprintf('transactions.%d.id', $index), (string)trans('validation.need_id_to_match'));return;}@@ -419,7 +419,7 @@ trait RecurrenceValidation$maxUnmatched = max(1, $submittedTrCount - $originalTrCount);Log::debug(sprintf('Submitted: %d. Original: %d. User can submit %d unmatched transactions.', $submittedTrCount, $originalTrCount, $maxUnmatched));if ($unmatchedIds > $maxUnmatched) {- Log::warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));+ app('log')->warning(sprintf('Too many unmatched transactions (%d).', $unmatchedIds));$validator->errors()->add('transactions.0.id', (string)trans('validation.too_many_unmatched'));return;}