From 4e5bf52905088811a0299a4026ecc9ff981ed61e Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 19 Jul 2024 16:00:24 +0200 Subject: [PATCH 1/2] ObjectsRendererHook: Catch not just exceptions.. --- library/Notifications/Hook/ObjectsRendererHook.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/library/Notifications/Hook/ObjectsRendererHook.php b/library/Notifications/Hook/ObjectsRendererHook.php index 5d0af3ff..93b3e9c1 100644 --- a/library/Notifications/Hook/ObjectsRendererHook.php +++ b/library/Notifications/Hook/ObjectsRendererHook.php @@ -4,7 +4,6 @@ namespace Icinga\Module\Notifications\Hook; -use Exception; use Generator; use Icinga\Application\Hook; use Icinga\Application\Logger; @@ -16,6 +15,7 @@ use ipl\Html\ValidHtml; use ipl\Web\Url; use ipl\Web\Widget\Link; +use Throwable; /** * Base hook to prepare and render objects @@ -178,7 +178,7 @@ function ($object) { } } } - } catch (Exception $e) { + } catch (Throwable $e) { Logger::error('Failed to load hook %s:', get_class($hook), $e); } } @@ -289,7 +289,7 @@ final public static function renderObjectLink(Objects $object): ?ValidHtml ] ]); } - } catch (Exception $e) { + } catch (Throwable $e) { Logger::error('Failed to load hook %s:', get_class($hook), $e); } } From 05a668fe1aaa235669b79160d70254569f151a60 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 19 Jul 2024 16:01:57 +0200 Subject: [PATCH 2/2] run.php: Don't provide the builtin icingadb hook.. ..if that is not enabled --- run.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run.php b/run.php index 9e94cef8..8ac42099 100644 --- a/run.php +++ b/run.php @@ -4,7 +4,10 @@ /** @var \Icinga\Application\Modules\Module $this */ -$this->provideHook('Notifications/ObjectsRenderer'); +if ($this::exists('icingadb')) { + $this->provideHook('Notifications/ObjectsRenderer'); +} + $this->provideHook('authentication', 'SessionStorage', true); $this->addRoute( 'static-file',