From c42b2ff483da280228695546c0bca5f2d48172ec Mon Sep 17 00:00:00 2001 From: Yasen Pramatarov Date: Mon, 19 Jan 2026 17:55:49 +0200 Subject: [PATCH] Moves plugin loading after we have DB connection in index --- public_html/index.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/public_html/index.php b/public_html/index.php index 50fdb50..948a180 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -84,11 +84,6 @@ function register_plugin_route_prefix(string $prefix, array $definition = []): v PluginRouteRegistry::registerPrefix($prefix, $definition); } -// Load enabled plugins -$plugins_dir = dirname(__DIR__) . '/plugins/'; -$enabled_plugins = PluginManager::load($plugins_dir); -$GLOBALS['enabled_plugins'] = $enabled_plugins; - // Define CSRF token include path globally if (!defined('CSRF_TOKEN_INCLUDE')) { define('CSRF_TOKEN_INCLUDE', APP_PATH . 'includes/csrf_token.php'); @@ -178,6 +173,11 @@ use App\Core\DatabaseConnector; $db = DatabaseConnector::connect($config); App::set('db', $db); +// Load enabled plugins (we need this after DB connection is established) +$plugins_dir = dirname(__DIR__) . '/plugins/'; +$enabled_plugins = PluginManager::load($plugins_dir); +$GLOBALS['enabled_plugins'] = $enabled_plugins; + // Initialize Log throttler require_once APP_PATH . 'core/LogThrottler.php'; use App\Core\LogThrottler;