Files
XC_VM/docs/en/guides/diagnostics-api.md
T
Divarion-D 76844fef11 docs: restructure, fix PSR-4 drift, and unify en/ru
Overhaul the Docsify documentation (English + Russian) so it matches the current
codebase and follows one consistent pattern.

Content accuracy (post-migration):
- Rewrite development/autoloader.md to PSR-4 / Composer (the old XC_Autoloader
  scanner, igbinary tmp/cache/autoload_map and registerDirectories are gone).
- PascalCase every source path (src/core -> src/Core, domain/Stream, cli/Commands,
  public/Controllers, Infrastructure/Redis, ...) across all docs.
- Replace the removed autoload.php references with vendor/autoload.php
  (build_system, bootstrap-contexts, error-handling, modules).
- ssl-generation: note that the installer now auto-generates a unique self-signed
  certificate before Nginx starts.

Common pattern (Clean & uniform):
- Strip emoji from headings; remove the in-page Navigation blocks (the Docsify
  sidebar already provides navigation).
- One H1 + intro per doc; uniform "Related files" / "Связанные файлы" section,
  added to the code-centric docs that lacked it.

Structure:
- Remove the empty stray docs/api/; move updates_checklist.md into builds/;
  link the previously-orphaned ucs-integration.md.
- Regroup the sidebars (split the oversized guides group into Developer Guides /
  Security & Access / Integrations; fold builds into Build & Release).

Augment:
- dev-workflow: Local Setup (make dev-tools) + Quality Checks (phpstan, cs, gates).
- build_system: Composer Dependencies section (committed prod-only vendor,
  committed lock, dev tools via composer install, no build-time vendor step).

en/ru parity:
- Apply the same structure, fixes and pattern to docs/ru/ (translated), including
  a new Russian ucs-integration.md. The en and ru file sets are now identical.
2026-06-26 15:56:15 +03:00

93 lines
2.2 KiB
Markdown

# 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.
---
### `submitPanelLogs(object $db): string|false`
Submits panel logs to remote diagnostics endpoint and clears submitted logs.
Returns the response string on success, `false` on failure (e.g. API IP resolution fails).
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 |
---
### `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.
---
## Related files
| File | Purpose |
| --- | --- |
| `src/Core/Diagnostics/DiagnosticsService.php` | diagnostics methods |
| `src/Core/Logging/Logger.php` | writes logs |
| `src/Core/Config/AppConfig.php` | version metadata |