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;