Remove static references

This commit is contained in:
James Cole
2023-10-29 06:32:00 +01:00
parent e65d0eef6e
commit 075d459b7c
128 changed files with 391 additions and 391 deletions

View File

@@ -82,7 +82,7 @@ class DeleteEmptyJournals extends Command
TransactionJournal::find((int)$row->transaction_journal_id)->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete journal: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
app('log')->error($e->getTraceAsString());
}
@@ -114,7 +114,7 @@ class DeleteEmptyJournals extends Command
TransactionJournal::find($entry->id)->delete();
} catch (QueryException $e) {
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
app('log')->error($e->getTraceAsString());
}

View File

@@ -203,7 +203,7 @@ class ExportData extends Command
try {
$date = Carbon::createFromFormat('!Y-m-d', $this->option($field));
} catch (InvalidArgumentException $e) {
Log::error($e->getMessage());
app('log')->error($e->getMessage());
$this->friendlyError(sprintf('%s date "%s" must be formatted YYYY-MM-DD. Field will be ignored.', $field, $this->option('start')));
$error = true;
}

View File

@@ -66,13 +66,13 @@ class ScanAttachments extends Command
$fileName = $attachment->fileName();
$encryptedContent = $disk->get($fileName);
if (null === $encryptedContent) {
Log::error(sprintf('No content for attachment #%d under filename "%s"', $attachment->id, $fileName));
app('log')->error(sprintf('No content for attachment #%d under filename "%s"', $attachment->id, $fileName));
continue;
}
try {
$decryptedContent = Crypt::decrypt($encryptedContent); // verified
} catch (DecryptException $e) {
Log::error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
app('log')->error(sprintf('Could not decrypt data of attachment #%d: %s', $attachment->id, $e->getMessage()));
$decryptedContent = $encryptedContent;
}
$tempFileName = tempnam(sys_get_temp_dir(), 'FireflyIII');

View File

@@ -84,8 +84,8 @@ class Cron extends Command
try {
$this->exchangeRatesCronJob($force, $date);
} catch (FireflyException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
}
@@ -96,8 +96,8 @@ class Cron extends Command
try {
$this->recurringCronJob($force, $date);
} catch (FireflyException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
@@ -107,8 +107,8 @@ class Cron extends Command
try {
$this->autoBudgetCronJob($force, $date);
} catch (FireflyException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}
@@ -118,8 +118,8 @@ class Cron extends Command
try {
$this->billWarningCronJob($force, $date);
} catch (FireflyException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
app('log')->error($e->getMessage());
app('log')->error($e->getTraceAsString());
$this->friendlyError($e->getMessage());
}

View File

@@ -116,7 +116,7 @@ class DecryptDatabase extends Command
try {
$configVar = app('fireflyconfig')->get($configName, false);
} catch (FireflyException $e) {
Log::error($e->getMessage());
app('log')->error($e->getMessage());
}
if (null !== $configVar) {
return (bool)$configVar->data;
@@ -157,8 +157,8 @@ class DecryptDatabase extends Command
} catch (FireflyException $e) {
$message = sprintf('Could not decrypt field "%s" in row #%d of table "%s": %s', $field, $id, $table, $e->getMessage());
$this->friendlyError($message);
Log::error($message);
Log::error($e->getTraceAsString());
app('log')->error($message);
app('log')->error($e->getTraceAsString());
}
// A separate routine for preferences table:

View File

@@ -171,7 +171,7 @@ class TransactionIdentifier extends Command
->whereNotIn('id', $exclude)
->first();
} catch (QueryException $e) {
Log::error($e->getMessage());
app('log')->error($e->getMessage());
$this->friendlyError('Firefly III could not find the "identifier" field in the "transactions" table.');
$this->friendlyError(sprintf('This field is required for Firefly III version %s to run.', config('firefly.version')));
$this->friendlyError('Please run "php artisan migrate" to add this field to the table.');

View File

@@ -319,7 +319,7 @@ class TransferCurrenciesCorrections extends Command
// source account must have a currency preference.
if (null === $this->sourceCurrency) {
$message = sprintf('Account #%d ("%s") must have currency preference but has none.', $this->sourceAccount->id, $this->sourceAccount->name);
Log::error($message);
app('log')->error($message);
$this->friendlyError($message);
return true;
@@ -332,7 +332,7 @@ class TransferCurrenciesCorrections extends Command
$this->destinationAccount->id,
$this->destinationAccount->name
);
Log::error($message);
app('log')->error($message);
$this->friendlyError($message);
return true;

View File

@@ -78,19 +78,19 @@ trait VerifiesAccessToken
$user = $repository->find($userId);
if (null === $user) {
Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
app('log')->error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
return false;
}
$accessToken = app('preferences')->getForUser($user, 'access_token');
if (null === $accessToken) {
Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
app('log')->error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
return false;
}
if ($accessToken->data !== $token) {
Log::error(sprintf('Invalid access token for user #%d.', $userId));
Log::error(sprintf('Token given is "%s", expected something else.', $token));
app('log')->error(sprintf('Invalid access token for user #%d.', $userId));
app('log')->error(sprintf('Token given is "%s", expected something else.', $token));
return false;
}