feat: add read-only System Info admin page with health checks and module inventory
New page at /admin/system-info with three tabs:
- Overview: PHP version, SAPI, environment, 6 health checks (DB, schema,
storage, RBAC baseline, admin role, scheduler heartbeat)
- Modules: table of active modules with version, dependencies, permission count
- Permissions: active/inactive counts and per-source breakdown
Gated behind new system_info.view permission assigned to Admin role.
No mutations — purely diagnostic/observability.
Includes SystemHealthService, SystemInfoService, SystemHealthRepository
with interface, DI registration, i18n keys (de+en), idempotent DB update
script, and 17 new PHPUnit tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:08:02 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use MintyPHP\Buffer;
|
|
|
|
|
use MintyPHP\Service\Access\OperationsAuthorizationPolicy;
|
2026-04-24 16:32:46 +02:00
|
|
|
use MintyPHP\Service\System\SystemHealthService;
|
feat: add read-only System Info admin page with health checks and module inventory
New page at /admin/system-info with three tabs:
- Overview: PHP version, SAPI, environment, 6 health checks (DB, schema,
storage, RBAC baseline, admin role, scheduler heartbeat)
- Modules: table of active modules with version, dependencies, permission count
- Permissions: active/inactive counts and per-source breakdown
Gated behind new system_info.view permission assigned to Admin role.
No mutations — purely diagnostic/observability.
Includes SystemHealthService, SystemInfoService, SystemHealthRepository
with interface, DI registration, i18n keys (de+en), idempotent DB update
script, and 17 new PHPUnit tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:08:02 +01:00
|
|
|
use MintyPHP\Support\Guard;
|
|
|
|
|
|
|
|
|
|
Guard::requireAbilityOrForbidden(OperationsAuthorizationPolicy::ABILITY_ADMIN_SYSTEM_INFO_VIEW);
|
|
|
|
|
|
2026-04-24 16:32:46 +02:00
|
|
|
$checks = app(SystemHealthService::class)->runAll();
|
feat: add read-only System Info admin page with health checks and module inventory
New page at /admin/system-info with three tabs:
- Overview: PHP version, SAPI, environment, 6 health checks (DB, schema,
storage, RBAC baseline, admin role, scheduler heartbeat)
- Modules: table of active modules with version, dependencies, permission count
- Permissions: active/inactive counts and per-source breakdown
Gated behind new system_info.view permission assigned to Admin role.
No mutations — purely diagnostic/observability.
Includes SystemHealthService, SystemInfoService, SystemHealthRepository
with interface, DI registration, i18n keys (de+en), idempotent DB update
script, and 17 new PHPUnit tests.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 15:08:02 +01:00
|
|
|
|
2026-04-24 16:32:46 +02:00
|
|
|
$overall = 'ok';
|
|
|
|
|
foreach ($checks as $check) {
|
|
|
|
|
if ($check['status'] === 'fail') {
|
|
|
|
|
$overall = 'fail';
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if ($check['status'] === 'warn') {
|
|
|
|
|
$overall = 'warn';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$environment = 'unknown';
|
|
|
|
|
if (defined('APP_ENV')) {
|
|
|
|
|
$environment = (string) constant('APP_ENV');
|
|
|
|
|
} else {
|
|
|
|
|
$envVar = getenv('APP_ENV');
|
|
|
|
|
if (is_string($envVar) && $envVar !== '') {
|
|
|
|
|
$environment = $envVar;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$meta = [
|
|
|
|
|
'php_version' => PHP_VERSION,
|
|
|
|
|
'environment' => $environment,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$lastChecked = date('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
|
|
Buffer::set('title', t('System status'));
|
2026-04-05 17:17:06 +02:00
|
|
|
|
|
|
|
|
$breadcrumbs = [
|
|
|
|
|
['label' => t('Home'), 'path' => 'admin'],
|
2026-04-24 16:32:46 +02:00
|
|
|
['label' => t('System status')],
|
2026-04-05 17:17:06 +02:00
|
|
|
];
|