Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-08-31 15:31:17 +0300
committerVincent Petry <pvince81@owncloud.com>2015-08-31 15:31:17 +0300
commit3b37c203193b91253f814fa76257352279f5b6f3 (patch)
tree2c03d0db3f6d46e0763cd0363fec98f5ec8832ec /lib/private/updater.php
parentd5b0b55eefe6c397df2eafabc67514b4a38175fc (diff)
Simplify comparison algo
Diffstat (limited to 'lib/private/updater.php')
-rw-r--r--lib/private/updater.php16
1 files changed, 1 insertions, 15 deletions
diff --git a/lib/private/updater.php b/lib/private/updater.php
index 0f9ecfe93de..639571e8f70 100644
--- a/lib/private/updater.php
+++ b/lib/private/updater.php
@@ -235,22 +235,8 @@ class Updater extends BasicEmitter {
return false;
}
- $oldVersion = explode('.', $oldVersion);
- $newVersion = explode('.', $newVersion);
-
- while (count($oldVersion) > 2) {
- array_pop($oldVersion);
- }
-
- while (count($newVersion) > 2) {
- array_pop($newVersion);
- }
-
- $oldVersion = implode('.', $oldVersion);
- $newVersion = implode('.', $newVersion);
-
// either we're updating from an allowed version or the current version
- return (version_compare($allowedPreviousVersion, $oldVersion) === 0
+ return (version_compare($allowedPreviousVersion, $oldVersion, '<=')
|| version_compare($newVersion, $oldVersion) === 0);
}