mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Remove static references
This commit is contained in:
@@ -56,7 +56,7 @@ class TransferBudgets extends Command
|
||||
foreach ($set as $entry) {
|
||||
$message = sprintf('Transaction journal #%d is a %s, so has no longer a budget.', $entry->id, $entry->transactionType->type);
|
||||
$this->friendlyInfo($message);
|
||||
Log::debug($message);
|
||||
app('log')->debug($message);
|
||||
$entry->budgets()->sync([]);
|
||||
$count++;
|
||||
}
|
||||
@@ -66,7 +66,7 @@ class TransferBudgets extends Command
|
||||
}
|
||||
if (0 !== $count) {
|
||||
$message = sprintf('Corrected %d invalid budget/journal entries (entry).', $count);
|
||||
Log::debug($message);
|
||||
app('log')->debug($message);
|
||||
$this->friendlyInfo($message);
|
||||
}
|
||||
return 0;
|
||||
|
@@ -95,7 +95,7 @@ class ForceDecimalSize extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
Log::debug('Now in ForceDecimalSize::handle()');
|
||||
app('log')->debug('Now in ForceDecimalSize::handle()');
|
||||
$this->determineDatabaseType();
|
||||
|
||||
$this->friendlyError('Running this command is dangerous and can cause data loss.');
|
||||
|
@@ -66,7 +66,7 @@ class VerifySecurityAlerts extends Command
|
||||
$disk = Storage::disk('resources');
|
||||
// Next line is ignored because it's a Laravel Facade.
|
||||
if (!$disk->has('alerts.json')) {
|
||||
Log::debug('No alerts.json file present.');
|
||||
app('log')->debug('No alerts.json file present.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -76,19 +76,19 @@ class VerifySecurityAlerts extends Command
|
||||
/** @var array $array */
|
||||
foreach ($json as $array) {
|
||||
if ($version === $array['version'] && true === $array['advisory']) {
|
||||
Log::debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
app('log')->debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
// add advisory to configuration.
|
||||
$this->saveSecurityAdvisory($array);
|
||||
|
||||
// depends on level
|
||||
if ('info' === $array['level']) {
|
||||
Log::debug('INFO level alert');
|
||||
app('log')->debug('INFO level alert');
|
||||
$this->friendlyInfo($array['message']);
|
||||
|
||||
return 0;
|
||||
}
|
||||
if ('warning' === $array['level']) {
|
||||
Log::debug('WARNING level alert');
|
||||
app('log')->debug('WARNING level alert');
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
$this->friendlyWarning($array['message']);
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
@@ -96,7 +96,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
if ('danger' === $array['level']) {
|
||||
Log::debug('DANGER level alert');
|
||||
app('log')->debug('DANGER level alert');
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
$this->friendlyError($array['message']);
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
@@ -107,7 +107,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Log::debug(sprintf('No security alerts for version %s', $version));
|
||||
app('log')->debug(sprintf('No security alerts for version %s', $version));
|
||||
$this->friendlyPositive(sprintf('No security alerts for version %s', $version));
|
||||
return 0;
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->delete('upgrade_security_message');
|
||||
app('fireflyconfig')->delete('upgrade_security_level');
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not delete old security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -136,7 +136,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->set('upgrade_security_message', $array['message']);
|
||||
app('fireflyconfig')->set('upgrade_security_level', $array['level']);
|
||||
} catch (QueryException $e) {
|
||||
Log::debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
|
||||
app('log')->debug(sprintf('Could not save new security advisory, but thats OK: %s', $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -335,7 +335,7 @@ class ApplyRules extends Command
|
||||
// if in rule selection, or group in selection or all rules, it's included.
|
||||
$test = $this->includeRule($rule, $group);
|
||||
if (true === $test) {
|
||||
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
app('log')->debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
$rulesToApply->push($rule);
|
||||
}
|
||||
}
|
||||
|
@@ -125,7 +125,7 @@ class AppendBudgetLimitPeriods extends Command
|
||||
$limit->end_date->format('Y-m-d'),
|
||||
$period
|
||||
);
|
||||
Log::debug($msg);
|
||||
app('log')->debug($msg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -92,7 +92,7 @@ class MigrateAttachments extends Command
|
||||
$att->description = '';
|
||||
$att->save();
|
||||
|
||||
Log::debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
app('log')->debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
@@ -82,7 +82,7 @@ class MigrateJournalNotes extends Command
|
||||
|
||||
$note->text = $meta->data;
|
||||
$note->save();
|
||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
app('log')->debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
$meta->delete();
|
||||
|
||||
$count++;
|
||||
|
@@ -151,11 +151,11 @@ class MigrateToGroups extends Command
|
||||
{
|
||||
// double check transaction count.
|
||||
if ($journal->transactions->count() <= 2) {
|
||||
Log::debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
|
||||
app('log')->debug(sprintf('Will not try to convert journal #%d because it has 2 or less transactions.', $journal->id));
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
app('log')->debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
|
||||
$this->journalRepository->setUser($journal->user);
|
||||
$this->groupFactory->setUser($journal->user);
|
||||
@@ -193,11 +193,11 @@ class MigrateToGroups extends Command
|
||||
$paymentDate = $this->cliRepository->getMetaDate($journal, 'payment_date');
|
||||
$invoiceDate = $this->cliRepository->getMetaDate($journal, 'invoice_date');
|
||||
|
||||
Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
app('log')->debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($destTransactions as $transaction) {
|
||||
Log::debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
$opposingTr = $this->findOpposingTransaction($journal, $transaction);
|
||||
|
||||
if (null === $opposingTr) {
|
||||
@@ -256,9 +256,9 @@ class MigrateToGroups extends Command
|
||||
|
||||
$data['transactions'][] = $tArray;
|
||||
}
|
||||
Log::debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
app('log')->debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
$group = $this->groupFactory->create($data);
|
||||
Log::debug('Done calling transaction journal factory');
|
||||
app('log')->debug('Done calling transaction journal factory');
|
||||
|
||||
// delete the old transaction journal.
|
||||
$this->service->destroy($journal);
|
||||
@@ -266,7 +266,7 @@ class MigrateToGroups extends Command
|
||||
$this->count++;
|
||||
|
||||
// report on result:
|
||||
Log::debug(
|
||||
app('log')->debug(
|
||||
sprintf(
|
||||
'Migrated journal #%d into group #%d with these journals: #%s',
|
||||
$journal->id,
|
||||
@@ -310,8 +310,8 @@ class MigrateToGroups extends Command
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
$amount = (float)$transaction->amount * -1 === (float)$subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
Log::debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
app('log')->debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
app('log')->debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
|
||||
return $amount && $identifier;
|
||||
}
|
||||
@@ -328,13 +328,13 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function getTransactionBudget(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
Log::debug('Now in getTransactionBudget()');
|
||||
app('log')->debug('Now in getTransactionBudget()');
|
||||
|
||||
// try to get a budget ID from the left transaction:
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $left->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
|
||||
return (int)$budget->id;
|
||||
}
|
||||
@@ -343,11 +343,11 @@ class MigrateToGroups extends Command
|
||||
/** @var Budget|null $budget */
|
||||
$budget = $right->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
|
||||
return (int)$budget->id;
|
||||
}
|
||||
Log::debug('Neither left or right have a budget, return NULL');
|
||||
app('log')->debug('Neither left or right have a budget, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@@ -361,13 +361,13 @@ class MigrateToGroups extends Command
|
||||
*/
|
||||
private function getTransactionCategory(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
Log::debug('Now in getTransactionCategory()');
|
||||
app('log')->debug('Now in getTransactionCategory()');
|
||||
|
||||
// try to get a category ID from the left transaction:
|
||||
/** @var Category|null $category */
|
||||
$category = $left->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
|
||||
return (int)$category->id;
|
||||
}
|
||||
@@ -376,11 +376,11 @@ class MigrateToGroups extends Command
|
||||
/** @var Category|null $category */
|
||||
$category = $right->categories()->first();
|
||||
if (null !== $category) {
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
|
||||
return (int)$category->id;
|
||||
}
|
||||
Log::debug('Neither left or right have a category, return NULL');
|
||||
app('log')->debug('Neither left or right have a category, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@@ -394,7 +394,7 @@ class MigrateToGroups extends Command
|
||||
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
|
||||
$total = count($orphanedJournals);
|
||||
if ($total > 0) {
|
||||
Log::debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
app('log')->debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
$this->friendlyInfo(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
/** @var array $array */
|
||||
foreach ($orphanedJournals as $array) {
|
||||
|
Reference in New Issue
Block a user