Skip to content

Wallos: Open-source, self-hostable personal subscription tracker. Visualize your recurring expenses, manage your budget, and save money.

fix: deprecation message for null value (#479)

Miguel Ribeiro0274b1d5257f
diff --git a/admin.php b/admin.php
index 3652219..414de6c 100644
--- a/admin.php
+++ b/admin.php
@@ -237,8 +237,12 @@ $loginDisabledAllowed = $userCount == 1 && $settings['registrations_open'] == 0;
<?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
diff --git a/includes/version.php b/includes/version.php
index 9884b3c..dc38058 100644
--- a/includes/version.php
+++ b/includes/version.php
@@ -1,3 +1,3 @@
<?php
-$version = "v2.21.0";
+$version = "v2.21.1";
?>
\ No newline at end of file
diff --git a/index.php b/index.php
index 0d00cd3..b35fa6d 100644
--- a/index.php
+++ b/index.php
@@ -73,12 +73,17 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
<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
+ }
+ }
}
?>
@@ -219,7 +224,8 @@ $headerClass = count($subscriptions) > 0 ? "main-actions" : "main-actions hidden
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') {
?>
diff --git a/migrations/000025.php b/migrations/000025.php
index f46f4a5..26d0afd 100644
--- a/migrations/000025.php
+++ b/migrations/000025.php
@@ -14,7 +14,7 @@ $columnQuery = $db->query("SELECT * FROM pragma_table_info('admin') where name='
$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'");
diff --git a/scripts/admin.js b/scripts/admin.js
index 2d89161..8a26751 100644
--- a/scripts/admin.js
+++ b/scripts/admin.js
@@ -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);
}