Improved update version detection logic

This commit is contained in:
Vincent Petry 2015-08-31 18:34:44 +02:00
parent 3b37c20319
commit 6ccbf4bce6
1 changed files with 1 additions and 7 deletions

View File

@ -230,14 +230,8 @@ class Updater extends BasicEmitter {
* @return bool * @return bool
*/ */
public function isUpgradePossible($oldVersion, $newVersion, $allowedPreviousVersion) { public function isUpgradePossible($oldVersion, $newVersion, $allowedPreviousVersion) {
// downgrade is never allowed
if (version_compare($oldVersion, $newVersion, '>')) {
return false;
}
// either we're updating from an allowed version or the current version
return (version_compare($allowedPreviousVersion, $oldVersion, '<=') return (version_compare($allowedPreviousVersion, $oldVersion, '<=')
|| version_compare($newVersion, $oldVersion) === 0); && version_compare($oldVersion, $newVersion, '<='));
} }
/** /**