refactor: absorb includes/bootstrap/ into XC_Bootstrap

Merge the three legacy bootstrap files into XC_Bootstrap::boot(CONTEXT_ADMIN):

- admin_session.php → already covered by XC_Bootstrap::initSession()
- admin_runtime.php (status constants) → already covered by defineStatusConstants()
- admin_runtime.php (globals) → new initAdminGlobals() method
- admin_bootstrap.php (orchestrator) → eliminated, admin.php calls XC_Bootstrap directly

New private methods in XC_Bootstrap:
- initAdminGlobals(): MobileDetect, timeouts, servers, protocol, translator, admin_constants
- detectProtocol(): inlined issecure()+getProtocol() logic

Updated:
- includes/admin.php: require bootstrap.php + XC_Bootstrap::boot() instead of bridge
- Makefile: remove includes/bootstrap from LB_DIRS_TO_REMOVE
- ARCHITECTURE.md: remove bootstrap/ from tree and LB example
- docs/{en,ru}/builds/build_system.md: remove row from LB tables
- Comments in admin_functions_fc.php, functions.php

Deleted:
- includes/bootstrap/admin_bootstrap.php
- includes/bootstrap/admin_runtime.php
- includes/bootstrap/admin_session.php
This commit is contained in:
Divarion-D
2026-03-18 21:34:00 +03:00
parent d75080ddc5
commit 2dd8d3bd1e
11 changed files with 55 additions and 187 deletions
+51
View File
@@ -186,6 +186,7 @@ class XC_Bootstrap {
self::initAdminAPI();
self::initTranslator();
self::registerAdminShutdown();
self::initAdminGlobals();
break;
}
@@ -574,6 +575,56 @@ class XC_Bootstrap {
}
}
/**
* Инициализация admin-глобалов: MobileDetect, таймауты, серверы,
* протокол, admin_constants.
*
* Логика из includes/bootstrap/admin_runtime.php (post-bootstrap block)
* + includes/bootstrap/admin_bootstrap.php (admin_constants.php).
*/
private static function initAdminGlobals(): void {
global $rDetect, $rMobile, $rTimeout, $rSQLTimeout, $rProtocol,
$allServers, $rServers, $rSettings, $rProxyServers,
$rPermissions, $language, $allowedLangs;
if (!defined('SERVER_ID')) {
define('SERVER_ID', intval(ConfigReader::get('server_id')));
}
require_once INCLUDES_PATH . 'libs/mobiledetect.php';
$rDetect = new \Mobile_Detect();
$rMobile = $rDetect->isMobile();
$rTimeout = 15;
$rSQLTimeout = 10;
set_time_limit($rTimeout);
ini_set('mysql.connect_timeout', (string) $rSQLTimeout);
ini_set('max_execution_time', (string) $rTimeout);
ini_set('default_socket_timeout', (string) $rTimeout);
$rProtocol = self::detectProtocol();
$allServers = ServerRepository::getAllSimple();
$rServers = ServerRepository::getStreamingSimple($rPermissions);
$rSettings = SettingsManager::getAll();
$rProxyServers = ServerRepository::getProxySimple($rPermissions);
$language = Translator::class;
$allowedLangs = $language::available();
require_once MAIN_HOME . 'resources/data/admin_constants.php';
}
/**
* Определить HTTP-протокол (http/https).
*
* Перенесено из includes/admin.php (issecure + getProtocol).
*/
private static function detectProtocol(): string {
$https = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off';
$port443 = isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443;
return ($https || $port443) ? 'https' : 'http';
}
// ─────────────────────────────────────────────────────────
// Вспомогательные статусные константы (из admin.php)
// ─────────────────────────────────────────────────────────