From 69fe8f77556fd0006cfc58c9638cc28123b39036 Mon Sep 17 00:00:00 2001 From: Yonas Habteab Date: Fri, 8 Apr 2022 10:27:35 +0200 Subject: [PATCH] Menu: Swallow silently any DB issue in the main menu --- library/Icinga/Web/Menu.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/library/Icinga/Web/Menu.php b/library/Icinga/Web/Menu.php index 9423dbe93..6c0bd4ab6 100644 --- a/library/Icinga/Web/Menu.php +++ b/library/Icinga/Web/Menu.php @@ -163,15 +163,21 @@ class Menu extends Navigation $homes = Home::on(Dashboard::getConn()); $homes->filter(Filter::equal('username', $user->getUsername())); - foreach ($homes as $home) { - $dashboardHome = new DashboardHomeItem($home->name, [ - 'uuid' => $home->id, - 'label' => t($home->label), - 'priority' => $home->priority, - 'type' => $home->type, - ]); + try { + foreach ($homes as $home) { + $dashboardHome = new DashboardHomeItem($home->name, [ + 'uuid' => $home->id, + 'label' => t($home->label), + 'priority' => $home->priority, + 'type' => $home->type, + ]); - $dashboardItem->addChild($dashboardHome); + $dashboardItem->addChild($dashboardHome); + } + } catch (\Exception $_) { + // Nothing to do + // Any database issue will be noticed soon enough, so prevent the Menu + // from being ruined in any case. } }