From 576309081f060b1740f8bb231b601f3473778ee1 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sat, 10 Aug 2019 23:44:49 +0200 Subject: [PATCH 1/6] imprive hasUpdate check --- .../components/com_joomlaupdate/models/default.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index bc437e9088551..a3f02a46d68ac 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -170,7 +170,12 @@ public function getUpdateInformation() } $ret['latest'] = $updateObject->version; - $ret['hasUpdate'] = $updateObject->version != JVERSION; + + // Check whether this is an update or not. + if (version_compare($updateObject->version, JVERSION) === 1) + { + $ret['hasUpdate'] = true; + } // Fetch the full update details from the update details URL. jimport('joomla.updater.update'); From f8c5eda517f06b76aa47c980e4945feabbb39e1b Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 11 Aug 2019 00:25:57 +0200 Subject: [PATCH 2/6] make sure outdated versions are not shown --- .../components/com_joomlaupdate/models/default.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index a3f02a46d68ac..c7fa59a37b1d2 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -169,7 +169,15 @@ public function getUpdateInformation() return $ret; } - $ret['latest'] = $updateObject->version; + // This update points to an outdated version + if (version_compare($updateObject->version, JVERSION) === -1) + { + $ret['latest'] = JVERSION; + + return $ret; + } + + $ret['latest'] = $updateObject->version; // Check whether this is an update or not. if (version_compare($updateObject->version, JVERSION) === 1) From 535a3847f4d21f83c80c698d4ab23fb99eaf107a Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 11 Aug 2019 00:46:03 +0200 Subject: [PATCH 3/6] move the inline comments --- administrator/components/com_joomlaupdate/models/default.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index c7fa59a37b1d2..62301217ef92a 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -164,14 +164,16 @@ public function getUpdateInformation() if (is_null($updateObject)) { + // We have not found any update in the database we seem to run the latest version $ret['latest'] = JVERSION; return $ret; } - // This update points to an outdated version + // Check whether this is an valid update or not if (version_compare($updateObject->version, JVERSION) === -1) { + // This update points to an outdated version we should not offer to update to this $ret['latest'] = JVERSION; return $ret; From fe34654d389c77d1725887e4751493038ab60c97 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 11 Aug 2019 21:50:00 +0200 Subject: [PATCH 4/6] use the operator thanks @mbabker --- administrator/components/com_joomlaupdate/models/default.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index 62301217ef92a..f1d07e549eeba 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -171,7 +171,7 @@ public function getUpdateInformation() } // Check whether this is an valid update or not - if (version_compare($updateObject->version, JVERSION) === -1) + if (version_compare($updateObject->version, JVERSION, 'version; // Check whether this is an update or not. - if (version_compare($updateObject->version, JVERSION) === 1) + if (version_compare($updateObject->version, JVERSION, '>')) { $ret['hasUpdate'] = true; } From a5f0ef244d7a5462fa81fd24afc82c232ace9806 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Sun, 11 Aug 2019 21:50:43 +0200 Subject: [PATCH 5/6] typo --- administrator/components/com_joomlaupdate/models/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index f1d07e549eeba..d6676fd4b00da 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -171,7 +171,7 @@ public function getUpdateInformation() } // Check whether this is an valid update or not - if (version_compare($updateObject->version, JVERSION, 'version, JVERSION, '<')) { // This update points to an outdated version we should not offer to update to this $ret['latest'] = JVERSION; From e3cc50c78d22a38f1686d053c46f767fcbf75400 Mon Sep 17 00:00:00 2001 From: zero-24 Date: Mon, 12 Aug 2019 22:43:22 +0200 Subject: [PATCH 6/6] Update administrator/components/com_joomlaupdate/models/default.php Co-Authored-By: Richard Fath --- administrator/components/com_joomlaupdate/models/default.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/administrator/components/com_joomlaupdate/models/default.php b/administrator/components/com_joomlaupdate/models/default.php index d6676fd4b00da..c40faad3e99ac 100644 --- a/administrator/components/com_joomlaupdate/models/default.php +++ b/administrator/components/com_joomlaupdate/models/default.php @@ -170,7 +170,7 @@ public function getUpdateInformation() return $ret; } - // Check whether this is an valid update or not + // Check whether this is a valid update or not if (version_compare($updateObject->version, JVERSION, '<')) { // This update points to an outdated version we should not offer to update to this