2026-04-17 19:56:58 +03:00
|
|
|
# Diagnostics Service
|
|
|
|
|
|
|
|
|
|
`DiagnosticsService` provides operational diagnostics helpers:
|
|
|
|
|
|
|
|
|
|
- SSL certificate inspection
|
|
|
|
|
- codec compatibility checks
|
|
|
|
|
- panel log export/submission
|
|
|
|
|
- external API IP detection
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
### `getCertificateInfo(?string $certificate = null): ?array`
|
|
|
|
|
|
|
|
|
|
Returns certificate details (`serial`, `expiration`, `subject`, `path`).
|
|
|
|
|
|
|
|
|
|
If `$certificate` is null, certificate path is auto-detected from nginx SSL config.
|
|
|
|
|
Returns `null` if file is missing or OpenSSL parsing fails.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### `checkCompatibility(array|string $data, bool $allowHEVC = false): bool`
|
|
|
|
|
|
|
|
|
|
Checks whether media codecs are compatible with player constraints.
|
|
|
|
|
Accepts FFProbe payload as array or JSON string.
|
|
|
|
|
|
|
|
|
|
Default accepted codecs include:
|
|
|
|
|
|
|
|
|
|
- video: `h264`, `vp8`, `vp9`, `ogg`, `av1`
|
|
|
|
|
- audio: `aac`, `libfdk_aac`, `opus`, `vorbis`, `pcm_s16le`, `mp2`, `mp3`, `flac`
|
|
|
|
|
|
|
|
|
|
With `$allowHEVC=true`, allows `hevc`/`h265` and `ac3`.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### `downloadPanelLogs(object $db): array`
|
|
|
|
|
|
|
|
|
|
Fetches up to 1000 recent rows from `panel_logs` (excluding `epg`), sanitizes output fields, and clears log rows after export.
|
|
|
|
|
|
|
|
|
|
Return shape:
|
|
|
|
|
|
|
|
|
|
```php
|
|
|
|
|
[
|
|
|
|
|
'errors' => [...],
|
|
|
|
|
'version' => '...'
|
|
|
|
|
]
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Throws `Exception` on DB query failure.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-21 11:30:14 -04:00
|
|
|
### `submitPanelLogs(object $db): string|false`
|
2026-04-17 19:56:58 +03:00
|
|
|
|
|
|
|
|
Submits panel logs to remote diagnostics endpoint and clears submitted logs.
|
2026-05-21 11:30:14 -04:00
|
|
|
Returns the response string on success, `false` on failure (e.g. API IP resolution fails).
|
2026-04-17 19:56:58 +03:00
|
|
|
Used for support/telemetry workflows.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## `panel_logs` Shape (used fields)
|
|
|
|
|
|
|
|
|
|
| Column | Type | Meaning |
|
|
|
|
|
| --- | --- | --- |
|
|
|
|
|
| `type` | string | event type |
|
|
|
|
|
| `log_message` | string | main message |
|
|
|
|
|
| `log_extra` | string | extra context |
|
|
|
|
|
| `line` | int | source line |
|
|
|
|
|
| `date` | int | UNIX timestamp |
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-05-21 11:30:14 -04:00
|
|
|
### `getPIDs(int $rServerID): array`
|
|
|
|
|
|
|
|
|
|
Parses system process information from server API response. Returns structured process data for monitoring.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
### `getNVENCProcesses(int $rServerID): array`
|
|
|
|
|
|
|
|
|
|
Extracts GPU (NVENC) process data from server GPU info. Used for GPU encoding diagnostics.
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
2026-06-26 15:56:15 +03:00
|
|
|
## Related files
|
2026-04-17 19:56:58 +03:00
|
|
|
|
|
|
|
|
| File | Purpose |
|
|
|
|
|
| --- | --- |
|
2026-06-26 15:56:15 +03:00
|
|
|
| `src/Core/Diagnostics/DiagnosticsService.php` | diagnostics methods |
|
|
|
|
|
| `src/Core/Logging/Logger.php` | writes logs |
|
2026-09-16 18:52:01 +03:00
|
|
|
| `src/Core/Config/ConstantsInitializer.php` | version metadata (`appConfig()` map) |
|