Files
XC_VM/docs/ru/guides/feature-flags.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

3.6 KiB

Флаги разработки

XC_VM использует константы и флаги из настроек для управления поведением системы.

Константы приложения хранятся в src/Core/Config/AppConfig.php.


Активные runtime-флаги

PHP_ERRORS

define('PHP_ERRORS', $rShowErrors); // из $rSettings['debug_show_errors']

PHP_ERRORS используется для управления отображением ошибок PHP и уровнем debug-вывода в логгере:

Logger::init(PHP_ERRORS, LOGS_TMP_PATH . 'error_log.log');

При PHP_ERRORS=true логгер выводит расширенные сообщения на экран.

DB_ACCESS_ENABLED

define('DB_ACCESS_ENABLED', false); // включает вкладку/страницу phpMiniAdmin в админ-панели

DB_ACCESS_ENABLED управляет только доступом к phpMiniAdmin из admin UI. Этот флаг не блокирует основные подключения приложения к базе данных.


Флаги из настроек ($rSettings)

Ряд поведенческих флагов хранится в настройках панели и загружается в $rSettings:

Ключ Тип Описание
debug_show_errors bool Показывать детальные ошибки вместо 404 (только dev)
recaptcha_enable bool Включить reCAPTCHA v2 на форме входа
verify_host bool Проверять домен из allowed_domains при каждом запросе
save_login_logs bool Записывать все попытки входа в login_logs

Эти настройки загружаются из файлового кеша (CACHE_TMP_PATH/settings) через RequestGuard.


Статические константы приложения

define('DB_ACCESS_ENABLED', false);
define('XC_VM_VERSION', '2.1.2');
define('GIT_OWNER', 'Vateron-Media');
define('GIT_REPO_MAIN', 'XC_VM');
define('GIT_REPO_UPDATE', 'XC_VM_Update');
define('GIT_REPO_BIN', 'XC_VM_Binaries');
define('MONITOR_CALLS', 3);
define('OPENSSL_EXTRA', '...');

Добавление нового флага

Для добавления флага уровня приложения — добавьте define() в AppConfig.php:

define('MY_FEATURE_FLAG', false);

Для флагов, которыми должен управлять администратор через UI — добавьте ключ в таблицу settings и используйте $rSettings['my_feature_flag'].

Не дублируйте одну и ту же настройку в обоих местах. Статические константы — для инфраструктурных значений. $rSettings — для пользовательских настроек.


Связанные файлы

Файл Назначение
src/Core/Config/AppConfig.php Статические флаги и константы
src/Core/Http/RequestGuard.php Загружает $rSettings из кеша
src/Core/Error/ErrorHandler.php Использует debug_show_errors
src/Core/Logging/Logger.php Использует PHP_ERRORS