mirror of
https://github.com/Vateron-Media/XC_VM.git
synced 2026-10-28 11:03:18 +01:00
Refactor configuration handling and database connections
- Removed ConfigLoader.php and transitioned to using ConfigReader for configuration management. - Updated DatabaseHandler instantiation to no longer rely on global $_INFO, instead using default parameters. - Enhanced Database and MigrationRunner classes to improve error handling and connection management. - Simplified RedisManager connection logic by utilizing XC_VM::redis_connect(). - Adjusted various controllers and services to align with the new configuration and database connection methods. - Removed unnecessary global variables and improved code readability across multiple files. - Updated comments and documentation to reflect changes in configuration handling and database connections.
This commit is contained in:
@@ -41,7 +41,6 @@ class WebApiBootstrap {
|
||||
require_once MAIN_HOME . 'core/Config/Paths.php';
|
||||
require_once MAIN_HOME . 'core/Config/AppConfig.php';
|
||||
require_once MAIN_HOME . 'core/Config/Binaries.php';
|
||||
require_once MAIN_HOME . 'core/Config/ConfigLoader.php';
|
||||
|
||||
// ── 4. Flood / host / Logger ─────────────────────────────
|
||||
require_once MAIN_HOME . 'core/Http/RequestGuard.php';
|
||||
@@ -51,17 +50,17 @@ class WebApiBootstrap {
|
||||
require_once MAIN_HOME . 'core/Database/DatabaseHandler.php';
|
||||
require_once MAIN_HOME . 'core/Updates/GithubReleases.php';
|
||||
|
||||
global $_INFO, $db, $gitRelease;
|
||||
global $db, $gitRelease;
|
||||
|
||||
$rCachedEndpoints = ['enigma2', 'epg', 'playlist', 'api', 'xplugin', 'live', 'proxy_api', 'thumb', 'timeshift', 'vod'];
|
||||
$rUseCache = in_array($rFilename, $rCachedEndpoints, true);
|
||||
|
||||
$db = new DatabaseHandler($_INFO['username'], $_INFO['password'], $_INFO['database'], $_INFO['hostname'], $_INFO['port']);
|
||||
$db = new DatabaseHandler();
|
||||
DatabaseFactory::set($db);
|
||||
LegacyInitializer::initCore($rUseCache);
|
||||
|
||||
if ($rUseCache && !SettingsManager::getAll()['enable_cache']) {
|
||||
$db = new DatabaseHandler($_INFO['username'], $_INFO['password'], $_INFO['database'], $_INFO['hostname'], $_INFO['port']);
|
||||
$db = new DatabaseHandler();
|
||||
DatabaseFactory::set($db);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user