mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-09-26 12:01:57 +02:00
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.
3.7 KiB
3.7 KiB
Bootstrap Contexts
XC_Bootstrap is the single entry point for system initialization.
Each context loads only the subsystems required for its execution path.
The context is expressed as a BootContext enum value.
Quick Reference
| Enum case | Typical usage |
|---|---|
BootContext::MINIMAL |
Scripts that need only paths/config |
BootContext::CLI |
Cron jobs and CLI commands |
BootContext::STREAM |
Streaming endpoints (live, vod, timeshift) |
BootContext::ADMIN |
Admin/reseller panel |
Context Details
BootContext::MINIMAL
Loads constants, paths, config, logger, and error handlers. No database connection.
Includes:
- Composer PSR-4 autoloader (
vendor/autoload.php) - path constants (
MAIN_HOME,INCLUDES_PATH, ...) - logger (
Logger::init()) - error helpers (
generateError(),generate404())
Excludes: DB, Redis, sessions, translator, admin APIs.
require_once '/home/xc_vm/bootstrap.php';
XC_Bootstrap::boot(BootContext::MINIMAL);
BootContext::CLI
Used for cron and CLI tasks.
Adds database and legacy core initialization over MINIMAL.
Includes:
- DB connection
LegacyInitializer- optional Redis (
'redis' => true) - optional process title (
'process' => '...')
require_once '/home/xc_vm/bootstrap.php';
XC_Bootstrap::boot(BootContext::CLI, [
'cached' => true,
'process' => 'xc_vm: my-job',
]);
BootContext::STREAM
Lightweight context for high-load streaming endpoints.
Includes:
- DB connection (
cached=true) - flood protection and host verification
Excludes: Redis, translator, admin APIs, sessions.
require_once '/home/xc_vm/bootstrap.php';
XC_Bootstrap::boot(BootContext::STREAM, ['cached' => true]);
BootContext::ADMIN
Full initialization for admin/reseller panel.
Includes:
- secure session (
SameSite=Strict) - DB connection (
cached=false) LegacyInitializer- Redis
- admin/reseller APIs
- translator
- shutdown handler
- status constants and admin globals
require_once '/home/xc_vm/bootstrap.php';
XC_Bootstrap::boot(BootContext::ADMIN);
Subsystem Matrix
| Subsystem | MINIMAL | CLI | STREAM | ADMIN |
|---|---|---|---|---|
| Constants/paths | ✅ | ✅ | ✅ | ✅ |
| Logger | ✅ | ✅ | ✅ | ✅ |
| Flood protection | — | — | ✅ | ✅ |
| Host verification | — | — | ✅ | ✅ |
| Database | — | ✅ | ✅ | ✅ |
| LegacyInitializer | — | ✅ | — | ✅ |
| Redis | — | opt | — | ✅ |
| Session | — | — | — | ✅ |
| Admin API | — | — | — | ✅ |
| Translator | — | — | — | ✅ |
boot() options
XC_Bootstrap::boot(BootContext $context, array $options = []);
| Option | Type | Default | Description |
|---|---|---|---|
cached |
bool |
true for STREAM, false otherwise |
Use cached settings |
redis |
bool |
true for ADMIN, false otherwise |
Connect Redis |
process |
string |
'' |
Process title for CLI |
shutdown |
callable |
built-in | Override shutdown callback |
Idempotency
boot() is executed once per process. Repeated calls are ignored.
XC_Bootstrap::boot(BootContext::ADMIN);
XC_Bootstrap::boot(BootContext::CLI); // ignored
For tests:
XC_Bootstrap::reset();
Public Methods
XC_Bootstrap::getContext(): ?BootContext
XC_Bootstrap::isBooted(): bool
XC_Bootstrap::isCli(): bool
XC_Bootstrap::getDatabase(): ?Database
XC_Bootstrap::getContainer(): ServiceContainer
Related files
| File | Role |
|---|---|
src/bootstrap.php |
Defines MAIN_HOME, requires the Composer autoloader, boots a context |
src/Core/Enum/BootContext.php |
Boot context enum |
src/Core/Init/LegacyInitializer.php |
Per-context legacy initialization |