Fix duplicate dashlets (#5245)

fixes #5203
This commit is contained in:
Johannes Meyer 2024-08-13 15:39:56 +02:00 committed by GitHub
commit 4ea3bebe07
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View File

@ -69,7 +69,7 @@ class IniWriter
*/ */
public function render() public function render()
{ {
if (file_exists($this->filename)) { if ($this->filename !== null && file_exists($this->filename)) {
$oldconfig = Config::fromIni($this->filename); $oldconfig = Config::fromIni($this->filename);
$content = trim(file_get_contents($this->filename)); $content = trim(file_get_contents($this->filename));
} else { } else {

View File

@ -147,15 +147,17 @@ class Dashboard extends AbstractWidget
if ($dashboardPane !== null) { if ($dashboardPane !== null) {
$key = $dashboardPane->getLabel(); $key = $dashboardPane->getLabel();
} }
$pane = null;
if ($this->hasPane($key)) { if ($this->hasPane($key)) {
$panes[$key] = $this->getPane($key); $pane = $this->getPane($key);
} else { } else {
$panes[$key] = new Pane($key); $pane = new Pane($key);
$panes[$key] = $pane;
$panes[$key]->setTitle($part->title); $panes[$key]->setTitle($part->title);
} }
$panes[$key]->setUserWidget(); $pane->setUserWidget();
if ((bool) $part->get('disabled', false) === true) { if ((bool) $part->get('disabled', false) === true) {
$panes[$key]->setDisabled(); $pane->setDisabled();
} }
} else { } else {
list($paneName, $dashletName) = explode('.', $key, 2); list($paneName, $dashletName) = explode('.', $key, 2);