Skip to content

Commit 4ea3beb

Browse files
authored
Fix duplicate dashlets (#5245)
fixes #5203
2 parents c27b43f + 81a3be7 commit 4ea3beb

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

library/Icinga/File/Ini/IniWriter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function __construct(Config $config, $filename, $filemode = 0660, $option
6969
*/
7070
public function render()
7171
{
72-
if (file_exists($this->filename)) {
72+
if ($this->filename !== null && file_exists($this->filename)) {
7373
$oldconfig = Config::fromIni($this->filename);
7474
$content = trim(file_get_contents($this->filename));
7575
} else {

library/Icinga/Web/Widget/Dashboard.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -147,15 +147,17 @@ protected function loadUserDashboardsFromFile($file, Navigation $dashboardNaviga
147147
if ($dashboardPane !== null) {
148148
$key = $dashboardPane->getLabel();
149149
}
150+
$pane = null;
150151
if ($this->hasPane($key)) {
151-
$panes[$key] = $this->getPane($key);
152+
$pane = $this->getPane($key);
152153
} else {
153-
$panes[$key] = new Pane($key);
154+
$pane = new Pane($key);
155+
$panes[$key] = $pane;
154156
$panes[$key]->setTitle($part->title);
155157
}
156-
$panes[$key]->setUserWidget();
158+
$pane->setUserWidget();
157159
if ((bool) $part->get('disabled', false) === true) {
158-
$panes[$key]->setDisabled();
160+
$pane->setDisabled();
159161
}
160162
} else {
161163
list($paneName, $dashletName) = explode('.', $key, 2);

0 commit comments

Comments
 (0)