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

Development Feature Flags

XC_VM uses constants and settings-driven flags to control environment behavior.

Application constants are stored in src/core/Config/AppConfig.php.


Active Runtime Flag

PHP_ERRORS

define('PHP_ERRORS', $rShowErrors); // derived from $rSettings['debug_show_errors']

PHP_ERRORS controls PHP/debug verbosity and logger screen output:

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

DB_ACCESS_ENABLED

define('DB_ACCESS_ENABLED', false); // enables phpMiniAdmin tab/page in admin panel

DB_ACCESS_ENABLED controls access to phpMiniAdmin from admin UI only. It does not block core application database connections.


Settings-driven Flags ($rSettings)

Loaded from settings cache and used in runtime decision points.

Key Type Meaning
debug_show_errors bool show detailed errors/debug output
recaptcha_enable bool enable reCAPTCHA v2 on login
verify_host bool enforce host allowlist validation
save_login_logs bool persist login attempts in login_logs

These values are loaded from CACHE_TMP_PATH/settings by request guards.


Static App Constants

From src/core/Config/AppConfig.php:

define('DB_ACCESS_ENABLED', false);
define('XC_VM_VERSION', '2.2.1');
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', '...');

Adding New Flags

Use static constants in AppConfig.php for fixed infrastructure/runtime constants. Use settings ($rSettings) for values that must be managed from panel UI.

Avoid defining the same behavior in both places.


File Purpose
src/core/Config/AppConfig.php static app constants
src/core/Http/RequestGuard.php loads $rSettings, sets PHP_ERRORS
src/core/Error/ErrorHandler.php uses debug_show_errors behavior
src/core/Logging/Logger.php debug/verbosity behavior