Loheide-eu-mitarbeiterplatt.../app/Filament/Pages/SystemHealth.php
Friederich Loheide cf5b71cdd9
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 4m40s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 4m27s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 5m6s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 5m14s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m55s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m54s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m59s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 6m57s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m43s
Fehlerprotokoll im Systemzustand, Bilder in Stellen- und Terminbeschreibungen (0.28.1)
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-27 10:32:14 +00:00

58 lines
1.9 KiB
PHP

<?php
namespace App\Filament\Pages;
use App\Support\BackgroundTasks;
use App\Support\ErrorLog;
use App\Support\SiteHealth;
use BackedEnum;
use Filament\Actions\Action;
use Filament\Pages\Page;
use Filament\Support\Icons\Heroicon;
use UnitEnum;
class SystemHealth extends Page
{
protected string $view = 'filament.pages.system-health';
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedHeart;
protected static string|UnitEnum|null $navigationGroup = 'System';
protected static ?int $navigationSort = 20;
protected static ?string $navigationLabel = 'Systemzustand';
protected static ?string $title = 'Systemzustand';
public static function canAccess(): bool
{
return auth()->user()?->can('updates.manage') ?? false;
}
protected static ?string $slug = 'systemzustand';
protected function getHeaderActions(): array
{
return [
Action::make('log')->label('Fehlerprotokoll herunterladen')->icon(Heroicon::OutlinedArrowDownTray)->color('gray')
->visible(fn () => app(ErrorLog::class)->latestFile() !== null)
->action(fn () => response()->streamDownload(function () {
echo app(ErrorLog::class)->tail((string) app(ErrorLog::class)->latestFile(), 2 * 1_048_576);
}, 'fehlerprotokoll-'.now()->format('Y-m-d-His').'.log', ['Content-Type' => 'text/plain; charset=UTF-8'])),
];
}
/**
* @return array<string, mixed>
*/
protected function getViewData(): array
{
return [
'groups' => app(SiteHealth::class)->all(),
'cronLine' => '* * * * * cd '.base_path().' && php artisan schedule:run >> /dev/null 2>&1',
'webCronUrl' => url('/cron/'.app(BackgroundTasks::class)->webCronToken()),
'logErrors' => app(ErrorLog::class)->recent(),
];
}
}