Skip to content

Commit

Permalink
fix: deprecation message for null value
Browse files Browse the repository at this point in the history
  • Loading branch information
Miguel Ribeiro committed Aug 6, 2024
1 parent 8c95b08 commit 9ca3827
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 11 deletions.
8 changes: 6 additions & 2 deletions admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,12 @@ class="one-third" value="<?= $settings['smtp_port'] ?>" />

<?php
// Get latest version from admin table
$latestVersion = $settings['latest_version'];
$hasUpdate = version_compare($version, $latestVersion) == -1;
if (!is_null($settings['latest_version'])) {
$latestVersion = $settings['latest_version'];
$hasUpdate = version_compare($version, $latestVersion) == -1;
} else {
$hasUpdate = false;
}

// find unused upload logos

Expand Down
2 changes: 1 addition & 1 deletion includes/version.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php
$version = "v2.21.0";
$version = "v2.21.1";
?>
20 changes: 13 additions & 7 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,17 @@

<section class="contain">
<?php
if ($isAdmin && $settings['update_notification'] && version_compare($version, $settings['latest_version']) == -1) {
?>
<div class="update-banner">
<?= translate('new_version_available', $i18n) ?>: <span><?= $settings['latest_version'] ?></span>
</div>
<?php
if ($isAdmin && $settings['update_notification']) {
if (!is_null($settings['latest_version'])) {
$latestVersion = $settings['latest_version'];
if (version_compare($version, $latestVersion) == -1) {
?>
<div class="update-banner">
<?= translate('new_version_available', $i18n) ?>: <span><?= $latestVersion ?></span>
</div>
<?php
}
}
}
?>

Expand Down Expand Up @@ -219,7 +224,8 @@
id="sort-category_id"><?= translate('category', $i18n) ?></li>
<li <?= $sortOrder == "payment_method_id" ? 'class="selected"' : "" ?>
onClick="setSortOption('payment_method_id')" id="sort-payment_method_id">
<?= translate('payment_method', $i18n) ?></li>
<?= translate('payment_method', $i18n) ?>
</li>
<?php
if (!isset($settings['hideDisabledSubscriptions']) || $settings['hideDisabledSubscriptions'] !== 'true') {
?>
Expand Down
2 changes: 1 addition & 1 deletion migrations/000025.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
$columnRequired = $columnQuery->fetchArray(SQLITE3_ASSOC) === false;

if ($columnRequired) {
$db->exec('ALTER TABLE admin ADD COLUMN latest_version TEXT');
$db->exec("ALTER TABLE admin ADD COLUMN latest_version TEXT DEFAULT 'v2.21.1'");
}

$columnQuery = $db->query("SELECT * FROM pragma_table_info('admin') where name='update_notification'");
Expand Down
3 changes: 3 additions & 0 deletions scripts/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,9 @@ function toggleUpdateNotification() {
.then(data => {
if (data.success) {
showSuccessMessage(data.message);
if (notificationEnabled === 1) {
fetch('endpoints/cronjobs/checkforupdates.php');
}
} else {
showErrorMessage(data.message);
}
Expand Down

0 comments on commit 9ca3827

Please sign in to comment.