From 49e84f2ad02fd19185660e6d5f9ced6173ddc335 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 2 Aug 2019 12:00:26 +0200 Subject: [PATCH 1/2] migrate: Don't fail dashboard migration just because a locale is missing --- .../migrate/application/clicommands/DashboardCommand.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/migrate/application/clicommands/DashboardCommand.php b/modules/migrate/application/clicommands/DashboardCommand.php index 4cb89a003..f0cb9356b 100644 --- a/modules/migrate/application/clicommands/DashboardCommand.php +++ b/modules/migrate/application/clicommands/DashboardCommand.php @@ -9,6 +9,7 @@ use Icinga\Application\Icinga; use Icinga\Application\Modules\DashboardContainer; use Icinga\Cli\Command; use Icinga\Application\Logger; +use Icinga\Exception\IcingaException; use Icinga\Util\Translator; use ReflectionClass; @@ -58,7 +59,12 @@ class DashboardCommand extends Command continue; } - Translator::setupLocale($locale); + try { + Translator::setupLocale($locale); + } catch (IcingaException $e) { + Logger::debug('Ignoring locale "%s". Reason: %s', $locale, $e->getMessage()); + continue; + } foreach ($paneItemsProperty->getValue($module) as $paneName => $container) { /** @var DashboardContainer $container */ From 53598ecd180f850d2ec46c01704908ba1ecdc53a Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Fri, 2 Aug 2019 14:14:28 +0200 Subject: [PATCH 2/2] DashboardCommand: Don't swallow custom dashboards --- .../migrate/application/clicommands/DashboardCommand.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/migrate/application/clicommands/DashboardCommand.php b/modules/migrate/application/clicommands/DashboardCommand.php index f0cb9356b..01b15477f 100644 --- a/modules/migrate/application/clicommands/DashboardCommand.php +++ b/modules/migrate/application/clicommands/DashboardCommand.php @@ -76,10 +76,7 @@ class DashboardCommand extends Command $dashletTitle = null; } - if (isset($options['disabled']) && mt($module->getName(), $paneName) !== $paneTitle) { - // `disabled` is checked because if it's a module's pane that's the only reason - // why it's in there. If a user utilized the same label though for a custom pane, - // it remains as is. + if (mt($module->getName(), $paneName) !== $paneTitle) { continue; } @@ -91,6 +88,10 @@ class DashboardCommand extends Command break; } } + + if ($dashletName === null) { + $dashletName = $dashletTitle; + } } $newSection = $paneName . ($dashletName ? '.' . $dashletName : '');