Expand debug info

This commit is contained in:
James Cole 2023-10-09 05:57:00 +02:00
parent d646ab0232
commit 4445ad8fe5
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80
2 changed files with 35 additions and 11 deletions

View File

@ -23,9 +23,9 @@ declare(strict_types=1);
namespace FireflyIII\Http\Controllers;
use Carbon\Carbon;
use DB;
use Exception;
use FireflyConfig;
use FireflyIII\Exceptions\FireflyException;
use FireflyIII\Http\Middleware\IsDemoUser;
use FireflyIII\Models\AccountType;
@ -229,8 +229,17 @@ class DebugController extends Controller
{
$userGuard = config('auth.defaults.guard');
$config = app('fireflyconfig')->get('last_rt_job', 0);
$lastTime = (int)$config->data;
$lastCronjob = 'never';
$lastCronjobAgo = 'never';
if ($lastTime > 0) {
$carbon = Carbon::createFromTimestamp($lastTime);
$lastCronjob = $carbon->format('Y-m-d H:i:s');
$lastCronjobAgo = $carbon->locale('en')->diffForHumans();
}
return [
'tz' => env('TZ'),
'debug' => var_export(config('app.debug'), true),
'audit_log_channel' => envNonEmpty('AUDIT_LOG_CHANNEL', '(empty)'),
'default_language' => (string)config('firefly.default_language'),
@ -238,6 +247,13 @@ class DebugController extends Controller
'remote_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_header') : 'N/A',
'remote_mail_header' => $userGuard === 'remote_user_guard' ? config('auth.guard_email') : 'N/A',
'stateful_domains' => join(', ', config('sanctum.stateful')),
// the dates for the cron job are based on the recurring cron job's times.
// any of the cron jobs will do, they always run at the same time.
// but this job is the oldest, so the biggest chance it ran once
'last_cronjob' => $lastCronjob,
'last_cronjob_ago' => $lastCronjobAgo,
];
}
@ -288,40 +304,40 @@ class DebugController extends Controller
// has liabilities
if ($user->accounts()->accountTypeIn([AccountType::DEBT, AccountType::LOAN, AccountType::MORTGAGE])->count() > 0) {
$flags[] = ':credit_card:';
$flags[] = '<span title="Has liabilities">:credit_card:</span>';
}
// has piggies
if ($user->piggyBanks()->count() > 0) {
$flags[] = ':pig:';
$flags[] = '<span title="Has piggy banks">:pig:</span>';
}
// has stored reconciliations
$type = TransactionType::whereType(TransactionType::RECONCILIATION)->first();
if ($user->transactionJournals()->where('transaction_type_id', $type->id)->count()) {
$flags[] = ':ledger:';
$flags[] = '<span title="Has reconciled">:ledger:</span>';
}
// has used importer?
// has rules
if ($user->rules()->count() > 0) {
$flags[] = ':wrench:';
$flags[] = '<span title="Has rules">:wrench:</span>';
}
// has recurring transactions
if ($user->recurrences()->count() > 0) {
$flags[] = ':clock130:';
$flags[] = '<span title="Has recurring transactions">:clock130:</span>';
}
// has groups
if ($user->objectGroups()->count() > 0) {
$flags[] = ':bookmark_tabs:';
$flags[] = '<span title="Has object groups">:bookmark_tabs:</span>';
}
// uses bills
if ($user->bills()->count() > 0) {
$flags[] = ':email:';
$flags[] = '<span title="Has subscriptions">:email:</span>';
}
return join(' ', $flags);
}

View File

@ -64,12 +64,16 @@
<tbody>
<tr>
<td>Timezone</td>
<td>{{ app.timezone }} + [BrowserTZ]</td>
<td>{{ config('app.timezone') }} + [BrowserTZ]</td>
</tr>
<tr>
<td>App environment</td>
<td>{{ config('app.env') }}, debug: {{ app.debug }}</td>
</tr>
<tr>
<td>Layout</td>
<td>{{ config('firefly.layout') }}</td>
</tr>
<tr>
<td>Logging</td>
<td>{{ config('logging.level') }}, {{ config('logging.default') }} / {{ app.audit_log_channel }}</td>
@ -98,6 +102,10 @@
<td>Stateful domains</td>
<td>{{ app.stateful_domains }}</td>
</tr>
<tr>
<td>Last cron job</td>
<td>{{ app.last_cronjob }} ({{ app.last_cronjob_ago }})</td>
</tr>
</tbody>
</table>
@ -118,7 +126,7 @@
</tr>
<tr>
<td>User flags</td>
<td>{{ user.user_flags }}</td>
<td>{{ user.user_flags | raw }}</td>
</tr>
<tr>
<td>Session start</td>