Files
XC_VM/docs/en/guides/diagnostics-api.md
T
Divarion-D f4555e7943 docs: reorganize structure, sync with current code, add missing framework reference
Structure:
- Split development/ (20 files) into development/ (framework reference) and guides/ (how-to)
- Moved 13 how-to files into new guides/ category (auth, cli, error-handling, etc.)
- Moved navbar-rendering.md from system/ into development/
- Deleted empty system/README.md files
- Deleted documentation_gaps.md (all gaps resolved) and redundant info/update.md

Sidebar / navbar:
- Removed all emojis from _sidebar.md (EN + RU) — fixes tree hierarchy rendering
- Removed flag emojis from _navbar.md language switcher
- Removed duplicate entries from the old "System Documentation" section
- Renamed section headers: "Development" -> "Framework Reference" + "Developer Guides"

Content fixes (modules.md EN + RU):
- Updated "Class naming" section: now documents XcVm\Module\{Pascal} namespaces
  (was "global PHP namespace — Until PHP namespaces are introduced")
- Updated main module class example to use namespace declaration + use statements
- Updated class naming in ModuleLoader description to FQN
- Replaced installCrontab() manual crontab instruction with getCronEntries() API
- Updated enable/disable section: added ModuleState enum table, updated config examples
- Fixed FAQ answer for disabling a module

Content fixes (bootstrap-contexts.md EN + RU):
- Replaced CONTEXT_* string constants with BootContext enum cases throughout
- Updated boot() signature: string $context -> BootContext $context
- Updated getContext() return type: ?string -> ?BootContext

New framework reference docs (EN + RU):
- docs/{en,ru}/development/event-system.md: EventDispatcher singleton bridge,
  #[ListensTo] attribute, getEventSubscribers() array API, stoppable events,
  built-in event catalog, custom event authoring, ListensTo attribute reference
- docs/{en,ru}/development/exception-hierarchy.md: full XcVmException tree,
  container vs module subtrees, PSR-11 compliance notes, catch-by-subsystem examples
2026-06-15 18:27:23 +03:00

2.2 KiB

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:

[
  '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.


File Purpose
src/core/Diagnostics/DiagnosticsService.php diagnostics methods
src/core/Logging/Logger.php writes logs
src/core/Config/AppConfig.php version metadata