Clean up debug page.

This commit is contained in:
James Cole
2022-03-10 17:59:30 +01:00
parent f0265b9fda
commit 43c52daf6b
2 changed files with 48 additions and 46 deletions

View File

@@ -120,49 +120,51 @@ class DebugController extends Controller
*/ */
public function index(Request $request) public function index(Request $request)
{ {
$search = ['~', '#']; // basic scope information:
$replace = ['\~', '# '];
$now = Carbon::now()->format('Y-m-d H:i:s e'); $now = Carbon::now()->format('Y-m-d H:i:s e');
$installationIdConfig = app('fireflyconfig')->get('installation_id', '');
$installationId = $installationIdConfig ? $installationIdConfig->data : '';
$phpVersion = str_replace($search, $replace, PHP_VERSION);
$phpOs = str_replace($search, $replace, PHP_OS);
$interface = PHP_SAPI;
$drivers = implode(', ', DB::availableDrivers());
$currentDriver = DB::getDriverName();
$userAgent = $request->header('user-agent');
$trustedProxies = config('firefly.trusted_proxies');
$displayErrors = ini_get('display_errors');
$errorReporting = $this->errorReporting((int)ini_get('error_reporting'));
$appEnv = config('app.env');
$appDebug = var_export(config('app.debug'), true);
$logChannel = config('logging.default');
$appLogLevel = config('logging.level');
$cacheDriver = config('cache.default');
$loginProvider = config('auth.providers.users.driver');
$bcscale = bcscale();
$layout = env('FIREFLY_III_LAYOUT');
$tz = env('TZ');
$buildNr = '(unknown)'; $buildNr = '(unknown)';
$buildDate = '(unknown)'; $buildDate = '(unknown)';
$expectedDBversion = config('firefly.db_version');
$foundDBversion = FireflyConfig::get('db_version', 1)->data;
if (file_exists('/var/www/counter-main.txt')) { if (file_exists('/var/www/counter-main.txt')) {
$buildNr = trim(file_get_contents('/var/www/counter-main.txt')); $buildNr = trim(file_get_contents('/var/www/counter-main.txt'));
} }
if (file_exists('/var/www/build-date-main.txt')) { if (file_exists('/var/www/build-date-main.txt')) {
$buildDate = trim(file_get_contents('/var/www/build-date-main.txt')); $buildDate = trim(file_get_contents('/var/www/build-date-main.txt'));
} }
$phpVersion = PHP_VERSION;
$phpOs = PHP_OS;
// expected + found DB version: // system information
$expectedDBversion = config('firefly.db_version'); $tz = env('TZ');
$foundDBversion = FireflyConfig::get('db_version', 1)->data; $appEnv = config('app.env');
$appDebug = var_export(config('app.debug'), true);
$cacheDriver = config('cache.default');
$logChannel = config('logging.default');
$appLogLevel = config('logging.level');
$displayErrors = ini_get('display_errors');
$errorReporting = $this->errorReporting((int) ini_get('error_reporting'));
$interface = PHP_SAPI;
$defaultLanguage = (string) config('firefly.default_language');
$defaultLocale = (string) config('firefly.default_locale');
$bcscale = bcscale();
$drivers = implode(', ', DB::availableDrivers());
$currentDriver = DB::getDriverName();
$trustedProxies = config('firefly.trusted_proxies');
// some new vars. // user info
$defaultLanguage = (string)config('firefly.default_language'); $loginProvider = config('auth.providers.users.driver');
$defaultLocale = (string)config('firefly.default_locale'); $userGuard = config('auth.defaults.guard');
$remoteHeader = $userGuard === 'remote_user_guard' ? config('auth.guard_header') : 'N/A';
$remoteMailHeader = $userGuard === 'remote_user_guard' ? config('auth.guard_email') : 'N/A';
$userLanguage = app('steam')->getLanguage(); $userLanguage = app('steam')->getLanguage();
$userLocale = app('steam')->getLocale(); $userLocale = app('steam')->getLocale();
$userAgent = $request->header('user-agent');
// expected + found DB version:
// some new vars.
$isDocker = env('IS_DOCKER', false); $isDocker = env('IS_DOCKER', false);
// set languages, see what happens: // set languages, see what happens:
@@ -211,17 +213,18 @@ class DebugController extends Controller
'logChannel', 'logChannel',
'tz', 'tz',
'appLogLevel', 'appLogLevel',
'remoteHeader',
'remoteMailHeader',
'now', 'now',
'drivers', 'drivers',
'currentDriver', 'currentDriver',
'userGuard',
'loginProvider', 'loginProvider',
'buildNr', 'buildNr',
'buildDate', 'buildDate',
'bcscale', 'bcscale',
'layout',
'userAgent', 'userAgent',
'displayErrors', 'displayErrors',
'installationId',
'errorReporting', 'errorReporting',
'phpOs', 'phpOs',
'interface', 'interface',
@@ -260,7 +263,7 @@ class DebugController extends Controller
$return = ' '; $return = ' ';
/** @var Route $route */ /** @var Route $route */
foreach ($set as $route) { foreach ($set as $route) {
$name = (string)$route->getName(); $name = (string) $route->getName();
if (in_array('GET', $route->methods(), true)) { if (in_array('GET', $route->methods(), true)) {
$found = false; $found = false;
foreach ($ignore as $string) { foreach ($ignore as $string) {

View File

@@ -17,15 +17,13 @@ Debug information generated at {{ now }} for Firefly III version **{{ FF_VERSION
| --- | --- | | --- | --- |
| Firefly III | {{ FF_VERSION }} | | Firefly III | {{ FF_VERSION }} |
| Firefly III API | {{ config('firefly.api_version') }} | | Firefly III API | {{ config('firefly.api_version') }} |
| Build | {{ buildNr}}, {{ buildDate }} | | Build | {{ buildNr }}, {{ buildDate }} |
| PHP | {{ phpVersion }} | | DB version | {{ foundDBversion }} (exp. {{ expectedDBversion}}) |
| Host | {{ phpOs }} | | PHP | `{{ phpVersion }}` |
| Host | `{{ phpOs }}` |
| System info | Value | | System info | Value |
| --- | --- | | --- | --- |
| Installation ID | {{ installationId }} |
| Using docker? | {% if isDocker %}true{% else %}false{% endif %} |
| Layout | {{ layout }} |
| System TZ | {{ tz }} | | System TZ | {{ tz }} |
| Browser TZ | [BrowserTZ] | | Browser TZ | [BrowserTZ] |
| App environment | {{ appEnv }} | | App environment | {{ appEnv }} |
@@ -40,12 +38,13 @@ Debug information generated at {{ now }} for Firefly III version **{{ FF_VERSION
| BCscale | {{ bcscale }} | | BCscale | {{ bcscale }} |
| DB drivers | {{ drivers }} | | DB drivers | {{ drivers }} |
| Current driver | {{ currentDriver }} | | Current driver | {{ currentDriver }} |
| DB version | {{ foundDBversion }} (exp. {{ expectedDBversion}}) | | Trusted proxies (.env) | `{{ trustedProxies }}` |
| Login provider | {{ loginProvider }} |
| Trusted proxies (.env) | {{ trustedProxies }} |
| User info | Value | | User info | Value |
| --- | --- | | --- | --- |
| Login provider | {{ loginProvider }} |
| User guard | {{ userGuard }} |
| Headers | {{ remoteHeader }}, {{ remoteMailHeader }} |
| Session start | {{ session('start') }} | | Session start | {{ session('start') }} |
| Session end | {{ session('end') }} | | Session end | {{ session('end') }} |
| Session first | {{ session('first') }} | | Session first | {{ session('first') }} |