Skip to content

Improve hasUpdate checks and make sure we don't offer updates to outdated versions#25810

Merged
HLeithner merged 7 commits intojoomla:stagingfrom
zero-24:improveHasUpdate
Aug 23, 2019
Merged

Improve hasUpdate checks and make sure we don't offer updates to outdated versions#25810
HLeithner merged 7 commits intojoomla:stagingfrom
zero-24:improveHasUpdate

Conversation

@zero-24
Copy link
Contributor

@zero-24 zero-24 commented Aug 10, 2019

Summary of Changes

Improve hasUpdate checks and make sure we don't offer downgrades to outdated versions

Testing Instructions

  • check for updates
  • go to the database table #__updates
  • manually change the core update versions collum to a lower version than the current.
  • go to the updater page (don't hit refresh)
  • see the message to update to an lower version than installed

Expected result

When we have an old version in the cache joomla says it runs the latest version

Actual result

When we have an older version in the cache Joomla wants to update to that version.

Documentation Changes Required

none

Additional info

The behavior we build by manually changing the database table can happen in case there is some caching of the old version of the update for some reason. one of many examples (german): https://forum.joomla.de/thread/8109-joomla-update-wird-nicht-angeboten-bzw-falsches-update-3-9-10/

@zero-24 zero-24 changed the title [4.0] Improve hasUpdate checks and make sure we don't offer updates to outdated versions [3.9] Improve hasUpdate checks and make sure we don't offer updates to outdated versions Aug 10, 2019
@ghost ghost changed the title [3.9] Improve hasUpdate checks and make sure we don't offer updates to outdated versions Improve hasUpdate checks and make sure we don't offer updates to outdated versions Aug 11, 2019
$ret['latest'] = $updateObject->version;
$ret['hasUpdate'] = $updateObject->version != JVERSION;
// Check whether this is an valid update or not
if (version_compare($updateObject->version, JVERSION) === -1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use version_compare() with three arguments, i.e. version_compare($updateObject->version, JVERSION, '<='). I've been writing PHP for 10 years and I couldn't tell you a thing about any of the return values of version_compare(), whereas specifying the comparison as the third parameter makes it crystal clear what you're intending here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

has been patched thanks 👍

@richard67
Copy link
Member

I have tested this item ✅ successfully on a5f0ef2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25810.

1 similar comment
@alikon
Copy link
Contributor

alikon commented Aug 12, 2019

I have tested this item ✅ successfully on a5f0ef2


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25810.

@alikon
Copy link
Contributor

alikon commented Aug 12, 2019

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25810.

@joomla-cms-bot joomla-cms-bot added the RTC This Pull Request is Ready To Commit label Aug 12, 2019
@wilsonge wilsonge added this to the Joomla! 3.9.12 milestone Aug 12, 2019
zero-24 and others added 2 commits August 12, 2019 22:43
Co-Authored-By: Richard Fath <richard67@users.noreply.github.com>
@richard67
Copy link
Member

I have tested this item ✅ successfully on dcf8c97


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/25810.

@richard67
Copy link
Member

Last change was only a code comment correction so @alikon 's test result is still valid.

@HLeithner
Copy link
Member

Thank you for stop downgrading offers.

@HLeithner HLeithner merged commit b89a64c into joomla:staging Aug 23, 2019
@joomla-cms-bot joomla-cms-bot removed the RTC This Pull Request is Ready To Commit label Aug 23, 2019
@zero-24 zero-24 deleted the improveHasUpdate branch August 23, 2019 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants