mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-15 08:35:00 +00:00
Replace log.
This commit is contained in:
@@ -34,6 +34,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CorrectsOpeningBalanceCurrencies extends Command
|
||||
{
|
||||
@@ -78,7 +79,7 @@ class CorrectsOpeningBalanceCurrencies extends Command
|
||||
$account = $this->getAccount($journal);
|
||||
if (!$account instanceof Account) {
|
||||
$message = sprintf('Transaction journal #%d has no valid account. Can\'t fix this line.', $journal->id);
|
||||
app('log')->warning($message);
|
||||
Log::warning($message);
|
||||
$this->friendlyError($message);
|
||||
|
||||
return 0;
|
||||
|
@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Enums\TransactionTypeEnum;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CorrectsTransferBudgets extends Command
|
||||
{
|
||||
@@ -53,13 +54,13 @@ class CorrectsTransferBudgets 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);
|
||||
app('log')->debug($message);
|
||||
Log::debug($message);
|
||||
$entry->budgets()->sync([]);
|
||||
++$count;
|
||||
}
|
||||
if (0 !== $count) {
|
||||
$message = sprintf('Corrected %d invalid budget/journal entries (entry).', $count);
|
||||
app('log')->debug($message);
|
||||
Log::debug($message);
|
||||
$this->friendlyInfo($message);
|
||||
}
|
||||
|
||||
|
@@ -152,7 +152,7 @@ class CorrectsUnevenAmount extends Command
|
||||
$entry->the_sum
|
||||
);
|
||||
$this->friendlyWarning($message);
|
||||
app('log')->warning($message);
|
||||
Log::warning($message);
|
||||
++$this->count;
|
||||
|
||||
continue;
|
||||
@@ -230,7 +230,7 @@ class CorrectsUnevenAmount extends Command
|
||||
$message = sprintf('Sum of journal #%d is not zero, journal is broken and now fixed.', $journal->id);
|
||||
|
||||
$this->friendlyWarning($message);
|
||||
app('log')->warning($message);
|
||||
Log::warning($message);
|
||||
|
||||
$destination->amount = $amount;
|
||||
$destination->save();
|
||||
|
@@ -30,6 +30,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RemovesEmptyJournals extends Command
|
||||
{
|
||||
@@ -68,8 +69,8 @@ class RemovesEmptyJournals extends Command
|
||||
$journal = TransactionJournal::find($row->transaction_journal_id);
|
||||
$journal?->delete();
|
||||
} catch (QueryException $e) {
|
||||
app('log')->info(sprintf('Could not delete journal: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::info(sprintf('Could not delete journal: %s', $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
|
||||
Transaction::where('transaction_journal_id', $row->transaction_journal_id)->delete();
|
||||
@@ -96,8 +97,8 @@ class RemovesEmptyJournals extends Command
|
||||
$journal = TransactionJournal::find($entry->id);
|
||||
$journal?->delete();
|
||||
} catch (QueryException $e) {
|
||||
app('log')->info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::info(sprintf('Could not delete entry: %s', $e->getMessage()));
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
|
||||
$this->friendlyInfo(sprintf('Deleted empty transaction journal #%d', $entry->id));
|
||||
|
@@ -37,6 +37,7 @@ use FireflyIII\Support\Export\ExportDataGenerator;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use InvalidArgumentException;
|
||||
|
||||
use function Safe\file_put_contents;
|
||||
@@ -189,7 +190,7 @@ class ExportsData extends Command
|
||||
try {
|
||||
$date = Carbon::createFromFormat('!Y-m-d', $this->option($field));
|
||||
} catch (InvalidArgumentException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
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;
|
||||
}
|
||||
@@ -200,7 +201,7 @@ class ExportsData extends Command
|
||||
}
|
||||
}
|
||||
if (null === $this->option($field)) {
|
||||
app('log')->info(sprintf('No date given in field "%s"', $field));
|
||||
Log::info(sprintf('No date given in field "%s"', $field));
|
||||
$error = true;
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use function Safe\mb_regex_encoding;
|
||||
use function Safe\json_encode;
|
||||
|
||||
@@ -95,7 +96,7 @@ class ForcesDecimalSize extends Command
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
app('log')->debug('Now in ForceDecimalSize::handle()');
|
||||
Log::debug('Now in ForceDecimalSize::handle()');
|
||||
$this->determineDatabaseType();
|
||||
|
||||
$this->friendlyError('Running this command is dangerous and can cause data loss.');
|
||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\System;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use League\Flysystem\FilesystemException;
|
||||
|
||||
@@ -54,7 +55,7 @@ class VerifySecurityAlerts extends Command
|
||||
$disk = Storage::disk('resources');
|
||||
// Next line is ignored because it's a Laravel Facade.
|
||||
if (!$disk->has('alerts.json')) { // @phpstan-ignore-line
|
||||
app('log')->debug('No alerts.json file present.');
|
||||
Log::debug('No alerts.json file present.');
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -64,19 +65,19 @@ class VerifySecurityAlerts extends Command
|
||||
/** @var array $array */
|
||||
foreach ($json as $array) {
|
||||
if ($version === $array['version'] && true === $array['advisory']) {
|
||||
app('log')->debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
Log::debug(sprintf('Version %s has an alert!', $array['version']));
|
||||
// add advisory to configuration.
|
||||
$this->saveSecurityAdvisory($array);
|
||||
|
||||
// depends on level
|
||||
if ('info' === $array['level']) {
|
||||
app('log')->debug('INFO level alert');
|
||||
Log::debug('INFO level alert');
|
||||
$this->friendlyInfo($array['message']);
|
||||
|
||||
return 0;
|
||||
}
|
||||
if ('warning' === $array['level']) {
|
||||
app('log')->debug('WARNING level alert');
|
||||
Log::debug('WARNING level alert');
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
$this->friendlyWarning($array['message']);
|
||||
$this->friendlyWarning('------------------------ :o');
|
||||
@@ -84,7 +85,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
if ('danger' === $array['level']) {
|
||||
app('log')->debug('DANGER level alert');
|
||||
Log::debug('DANGER level alert');
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
$this->friendlyError($array['message']);
|
||||
$this->friendlyError('------------------------ :-(');
|
||||
@@ -95,7 +96,7 @@ class VerifySecurityAlerts extends Command
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
app('log')->debug(sprintf('No security alerts for version %s', $version));
|
||||
Log::debug(sprintf('No security alerts for version %s', $version));
|
||||
$this->friendlyPositive(sprintf('No security alerts for version %s', $version));
|
||||
|
||||
return 0;
|
||||
@@ -107,7 +108,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->delete('upgrade_security_message');
|
||||
app('fireflyconfig')->delete('upgrade_security_level');
|
||||
} catch (QueryException $e) {
|
||||
app('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,7 +118,7 @@ class VerifySecurityAlerts extends Command
|
||||
app('fireflyconfig')->set('upgrade_security_message', $array['message']);
|
||||
app('fireflyconfig')->set('upgrade_security_level', $array['level']);
|
||||
} catch (QueryException $e) {
|
||||
app('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()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -315,7 +315,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) {
|
||||
app('log')->debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
Log::debug(sprintf('Will include rule #%d "%s"', $rule->id, $rule->title));
|
||||
$rulesToApply->push($rule);
|
||||
}
|
||||
}
|
||||
|
@@ -76,8 +76,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->exchangeRatesCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -87,8 +87,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->checkForUpdates($force);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -98,8 +98,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->recurringCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -109,8 +109,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->autoBudgetCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -120,8 +120,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->subscriptionWarningCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -130,8 +130,8 @@ class Cron extends Command
|
||||
try {
|
||||
$this->webhookCronJob($force, $date);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($e->getMessage());
|
||||
Log::error($e->getTraceAsString());
|
||||
$this->friendlyError($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddsTransactionIdentifiers extends Command
|
||||
@@ -147,7 +148,7 @@ class AddsTransactionIdentifiers extends Command
|
||||
->first()
|
||||
;
|
||||
} catch (QueryException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
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 --force" to add this field to the table.');
|
||||
|
@@ -31,6 +31,7 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Facades\Crypt;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use JsonException;
|
||||
use stdClass;
|
||||
|
||||
@@ -96,7 +97,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
try {
|
||||
$configVar = app('fireflyconfig')->get($configName, false);
|
||||
} catch (FireflyException $e) {
|
||||
app('log')->error($e->getMessage());
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
if (null !== $configVar) {
|
||||
return (bool) $configVar->data;
|
||||
@@ -129,8 +130,8 @@ class RemovesDatabaseDecryption 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);
|
||||
app('log')->error($message);
|
||||
app('log')->error($e->getTraceAsString());
|
||||
Log::error($message);
|
||||
Log::error($e->getTraceAsString());
|
||||
}
|
||||
|
||||
// A separate routine for preferences table:
|
||||
@@ -175,9 +176,9 @@ class RemovesDatabaseDecryption extends Command
|
||||
} catch (JsonException $e) {
|
||||
$message = sprintf('Could not JSON decode preference row #%d: %s. This does not have to be a problem.', $id, $e->getMessage());
|
||||
$this->friendlyError($message);
|
||||
app('log')->warning($message);
|
||||
app('log')->warning($value);
|
||||
app('log')->warning($e->getTraceAsString());
|
||||
Log::warning($message);
|
||||
Log::warning($value);
|
||||
Log::warning($e->getTraceAsString());
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -29,6 +29,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Note;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesAttachments extends Command
|
||||
{
|
||||
@@ -75,7 +76,7 @@ class UpgradesAttachments extends Command
|
||||
$att->description = '';
|
||||
$att->save();
|
||||
|
||||
app('log')->debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
Log::debug(sprintf('Migrated attachment #%s description to note #%d.', $att->id, $note->id));
|
||||
++$count;
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands\Upgrade;
|
||||
use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesBudgetLimitPeriods extends Command
|
||||
{
|
||||
@@ -84,7 +85,7 @@ class UpgradesBudgetLimitPeriods extends Command
|
||||
$limit->end_date->format('Y-m-d')
|
||||
);
|
||||
$this->friendlyWarning($message);
|
||||
app('log')->warning($message);
|
||||
Log::warning($message);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -98,7 +99,7 @@ class UpgradesBudgetLimitPeriods extends Command
|
||||
$limit->end_date->format('Y-m-d'),
|
||||
$period
|
||||
);
|
||||
app('log')->debug($msg);
|
||||
Log::debug($msg);
|
||||
}
|
||||
|
||||
private function getLimitPeriod(BudgetLimit $limit): ?string
|
||||
|
@@ -28,6 +28,7 @@ use FireflyIII\Console\Commands\ShowsFriendlyMessages;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\Models\TransactionJournalMeta;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesJournalNotes extends Command
|
||||
{
|
||||
@@ -66,7 +67,7 @@ class UpgradesJournalNotes extends Command
|
||||
|
||||
$note->text = $meta->data;
|
||||
$note->save();
|
||||
app('log')->debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
Log::debug(sprintf('Migrated meta note #%d to Note #%d', $meta->id, $note->id));
|
||||
$meta->delete();
|
||||
|
||||
++$count;
|
||||
|
@@ -35,6 +35,7 @@ use FireflyIII\Services\Internal\Destroy\TransactionGroupDestroyService;
|
||||
use FireflyIII\Services\Internal\Support\CreditRecalculateService;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesLiabilitiesEight extends Command
|
||||
{
|
||||
@@ -186,7 +187,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
return;
|
||||
}
|
||||
app('log')->warning('Did not find opening balance.');
|
||||
Log::warning('Did not find opening balance.');
|
||||
}
|
||||
|
||||
private function deleteTransactions(Account $account): int
|
||||
|
@@ -38,6 +38,7 @@ use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Exception;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesToGroups extends Command
|
||||
{
|
||||
@@ -127,11 +128,11 @@ class UpgradesToGroups extends Command
|
||||
{
|
||||
// double check transaction count.
|
||||
if ($journal->transactions->count() <= 2) {
|
||||
app('log')->debug(sprintf('Will not try to convert journal #%d because it has 2 or fewer transactions.', $journal->id));
|
||||
Log::debug(sprintf('Will not try to convert journal #%d because it has 2 or fewer transactions.', $journal->id));
|
||||
|
||||
return;
|
||||
}
|
||||
app('log')->debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
Log::debug(sprintf('Will now try to convert journal #%d', $journal->id));
|
||||
|
||||
$this->journalRepository->setUser($journal->user);
|
||||
$this->groupFactory->setUser($journal->user);
|
||||
@@ -144,15 +145,15 @@ class UpgradesToGroups extends Command
|
||||
];
|
||||
$destTransactions = $this->getDestinationTransactions($journal);
|
||||
|
||||
app('log')->debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
Log::debug(sprintf('Will use %d positive transactions to create a new group.', $destTransactions->count()));
|
||||
|
||||
/** @var Transaction $transaction */
|
||||
foreach ($destTransactions as $transaction) {
|
||||
$data['transactions'][] = $this->generateTransaction($journal, $transaction);
|
||||
}
|
||||
app('log')->debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
Log::debug(sprintf('Now calling transaction journal factory (%d transactions in array)', count($data['transactions'])));
|
||||
$group = $this->groupFactory->create($data);
|
||||
app('log')->debug('Done calling transaction journal factory');
|
||||
Log::debug('Done calling transaction journal factory');
|
||||
|
||||
// delete the old transaction journal.
|
||||
$this->service->destroy($journal);
|
||||
@@ -160,7 +161,7 @@ class UpgradesToGroups extends Command
|
||||
++$this->count;
|
||||
|
||||
// report on result:
|
||||
app('log')->debug(
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Migrated journal #%d into group #%d with these journals: #%s',
|
||||
$journal->id,
|
||||
@@ -190,7 +191,7 @@ class UpgradesToGroups extends Command
|
||||
*/
|
||||
private function generateTransaction(TransactionJournal $journal, Transaction $transaction): array
|
||||
{
|
||||
app('log')->debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
Log::debug(sprintf('Now going to add transaction #%d to the array.', $transaction->id));
|
||||
$opposingTr = $this->findOpposingTransaction($journal, $transaction);
|
||||
|
||||
if (!$opposingTr instanceof Transaction) {
|
||||
@@ -282,8 +283,8 @@ class UpgradesToGroups extends Command
|
||||
static function (Transaction $subject) use ($transaction) {
|
||||
$amount = (float) $transaction->amount * -1 === (float) $subject->amount; // intentional float
|
||||
$identifier = $transaction->identifier === $subject->identifier;
|
||||
app('log')->debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
app('log')->debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
Log::debug(sprintf('Amount the same? %s', var_export($amount, true)));
|
||||
Log::debug(sprintf('ID the same? %s', var_export($identifier, true)));
|
||||
|
||||
return $amount && $identifier;
|
||||
}
|
||||
@@ -294,13 +295,13 @@ class UpgradesToGroups extends Command
|
||||
|
||||
private function getTransactionBudget(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
app('log')->debug('Now in getTransactionBudget()');
|
||||
Log::debug('Now in getTransactionBudget()');
|
||||
|
||||
// try to get a budget ID from the left transaction:
|
||||
/** @var null|Budget $budget */
|
||||
$budget = $left->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $left->id));
|
||||
|
||||
return $budget->id;
|
||||
}
|
||||
@@ -309,11 +310,11 @@ class UpgradesToGroups extends Command
|
||||
/** @var null|Budget $budget */
|
||||
$budget = $right->budgets()->first();
|
||||
if (null !== $budget) {
|
||||
app('log')->debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
Log::debug(sprintf('Return budget #%d, from transaction #%d', $budget->id, $right->id));
|
||||
|
||||
return $budget->id;
|
||||
}
|
||||
app('log')->debug('Neither left or right have a budget, return NULL');
|
||||
Log::debug('Neither left or right have a budget, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@@ -321,13 +322,13 @@ class UpgradesToGroups extends Command
|
||||
|
||||
private function getTransactionCategory(Transaction $left, Transaction $right): ?int
|
||||
{
|
||||
app('log')->debug('Now in getTransactionCategory()');
|
||||
Log::debug('Now in getTransactionCategory()');
|
||||
|
||||
// try to get a category ID from the left transaction:
|
||||
/** @var null|Category $category */
|
||||
$category = $left->categories()->first();
|
||||
if (null !== $category) {
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $left->id));
|
||||
|
||||
return $category->id;
|
||||
}
|
||||
@@ -336,11 +337,11 @@ class UpgradesToGroups extends Command
|
||||
/** @var null|Category $category */
|
||||
$category = $right->categories()->first();
|
||||
if (null !== $category) {
|
||||
app('log')->debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
Log::debug(sprintf('Return category #%d, from transaction #%d', $category->id, $category->id));
|
||||
|
||||
return $category->id;
|
||||
}
|
||||
app('log')->debug('Neither left or right have a category, return NULL');
|
||||
Log::debug('Neither left or right have a category, return NULL');
|
||||
|
||||
// if all fails, return NULL.
|
||||
return null;
|
||||
@@ -354,7 +355,7 @@ class UpgradesToGroups extends Command
|
||||
$orphanedJournals = $this->cliRepository->getJournalsWithoutGroup();
|
||||
$total = count($orphanedJournals);
|
||||
if ($total > 0) {
|
||||
app('log')->debug(sprintf('Going to convert %d transaction journals. Please hold..', $total));
|
||||
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 */
|
||||
|
@@ -33,6 +33,7 @@ use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalCLIRepositoryInterface;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpgradesTransferCurrencies extends Command
|
||||
{
|
||||
@@ -262,7 +263,7 @@ class UpgradesTransferCurrencies extends Command
|
||||
// source account must have a currency preference.
|
||||
if (!$this->sourceCurrency instanceof TransactionCurrency) {
|
||||
$message = sprintf('Account #%d ("%s") must have currency preference but has none.', $this->sourceAccount->id, $this->sourceAccount->name);
|
||||
app('log')->error($message);
|
||||
Log::error($message);
|
||||
$this->friendlyError($message);
|
||||
|
||||
return true;
|
||||
@@ -275,7 +276,7 @@ class UpgradesTransferCurrencies extends Command
|
||||
$this->destinationAccount->id,
|
||||
$this->destinationAccount->name
|
||||
);
|
||||
app('log')->error($message);
|
||||
Log::error($message);
|
||||
$this->friendlyError($message);
|
||||
|
||||
return true;
|
||||
|
@@ -27,6 +27,7 @@ namespace FireflyIII\Console\Commands;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Trait VerifiesAccessToken.
|
||||
@@ -76,19 +77,19 @@ trait VerifiesAccessToken
|
||||
$user = $repository->find($userId);
|
||||
|
||||
if (null === $user) {
|
||||
app('log')->error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
|
||||
Log::error(sprintf('verifyAccessToken(): no such user for input "%d"', $userId));
|
||||
|
||||
return false;
|
||||
}
|
||||
$accessToken = app('preferences')->getForUser($user, 'access_token');
|
||||
if (null === $accessToken) {
|
||||
app('log')->error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
|
||||
Log::error(sprintf('User #%d has no access token, so cannot access command line options.', $userId));
|
||||
|
||||
return false;
|
||||
}
|
||||
if ($accessToken->data !== $token) {
|
||||
app('log')->error(sprintf('Invalid access token for user #%d.', $userId));
|
||||
app('log')->error(sprintf('Token given is "%s", expected something else.', $token));
|
||||
Log::error(sprintf('Invalid access token for user #%d.', $userId));
|
||||
Log::error(sprintf('Token given is "%s", expected something else.', $token));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Console;
|
||||
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
@@ -52,7 +53,7 @@ class Kernel extends ConsoleKernel
|
||||
{
|
||||
$schedule->call(
|
||||
static function (): void {
|
||||
app('log')->error(
|
||||
Log::error(
|
||||
'Firefly III no longer users the Laravel scheduler to do cron jobs! Please read the instructions at https://docs.firefly-iii.org/'
|
||||
);
|
||||
echo "\n";
|
||||
|
Reference in New Issue
Block a user