Skip to content

Commit

Permalink
Widget: clock widget upgrade issue (type changing back to analogue). (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dasgarner committed Jan 29, 2024
1 parent 8d77f87 commit e8f54f1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/XTR/WidgetCompatibilityTask.php
@@ -1,6 +1,6 @@
<?php
/*
* Copyright (C) 2023 Xibo Signage Ltd
* Copyright (C) 2024 Xibo Signage Ltd
*
* Xibo - Digital Signage - https://xibosignage.com
*
Expand Down Expand Up @@ -179,6 +179,7 @@ private function upgradeWidget(\PDOStatement $statement): void
$widgetCompatibilityInterface = $module->getWidgetCompatibilityOrNull();
if ($widgetCompatibilityInterface !== null) {
try {
// Pass the widget through the compatibility interface.
$upgraded = $widgetCompatibilityInterface->upgradeWidget(
$widget,
$widget->schemaVersion,
Expand All @@ -188,7 +189,12 @@ private function upgradeWidget(\PDOStatement $statement): void
// Save widget version
if ($upgraded) {
$widget->schemaVersion = $module->schemaVersion;
$widget->type = $module->type;

// Assert the module type, unless the widget has already changed it.
if (!$widget->hasPropertyChanged('type')) {
$widget->type = $module->type;
}

$widget->save(['alwaysUpdate' => true, 'upgrade' => true]);
$this->log->debug('WidgetCompatibilityTask: Upgraded');
}
Expand Down

0 comments on commit e8f54f1

Please sign in to comment.