diff --git a/lib/SP/Bootstrap.php b/lib/SP/Bootstrap.php index 935fc4f1..2f18e8b3 100644 --- a/lib/SP/Bootstrap.php +++ b/lib/SP/Bootstrap.php @@ -145,10 +145,6 @@ class Bootstrap $this->language = $container->get(Language::class); $this->upgrade = $container->get(Upgrade::class); - $eventDispatcher = $container->get(EventDispatcher::class); - $eventDispatcher->attach($container->get(LogHandler::class)); - $eventDispatcher->attach($container->get(NotificationHandler::class)); - $this->initRouter(); } @@ -488,6 +484,8 @@ class Bootstrap // Comprobar si es necesario actualizar componentes // $this->checkUpgrade(); + $this->initEventHandlers(); + // Inicializar la sesión $this->initUserSession(); @@ -650,6 +648,20 @@ class Bootstrap } } + /** + * Initializes event handlers + */ + protected function initEventHandlers() + { + $eventDispatcher = self::$container->get(EventDispatcher::class); + + if ($this->configData->isLogEnabled()) { + $eventDispatcher->attach(self::$container->get(LogHandler::class)); + } + + $eventDispatcher->attach(self::$container->get(NotificationHandler::class)); + } + /** * Comprobar si es necesario actualizar componentes * diff --git a/lib/SP/Services/Config/ConfigService.php b/lib/SP/Services/Config/ConfigService.php index 28189770..e2fd349f 100644 --- a/lib/SP/Services/Config/ConfigService.php +++ b/lib/SP/Services/Config/ConfigService.php @@ -79,7 +79,7 @@ class ConfigService extends Service ); } - return $query->value; + return empty($query->value) ? $default : $query->value; } /**