diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-08-30 18:03:33 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-08-30 18:07:22 +0200 |
commit | d5b0b55eefe6c397df2eafabc67514b4a38175fc (patch) | |
tree | 4f434ccc2869f0c7aaff3e04640e88c3245ecb21 /lib/private/util.php | |
parent | 2b08659f7d18d458339bcd89687469d8926f4941 (diff) | |
download | nextcloud-server-d5b0b55eefe6c397df2eafabc67514b4a38175fc.tar.gz nextcloud-server-d5b0b55eefe6c397df2eafabc67514b4a38175fc.zip |
Throw exception on downgrade attempt
Diffstat (limited to 'lib/private/util.php')
-rw-r--r-- | lib/private/util.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/private/util.php b/lib/private/util.php index edd375b5c36..47e42d8b7d3 100644 --- a/lib/private/util.php +++ b/lib/private/util.php @@ -1448,8 +1448,12 @@ class OC_Util { if ($config->getSystemValue('installed', false)) { $installedVersion = $config->getSystemValue('version', '0.0.0'); $currentVersion = implode('.', OC_Util::getVersion()); - if (version_compare($currentVersion, $installedVersion, '>')) { + $versionDiff = version_compare($currentVersion, $installedVersion); + if ($versionDiff > 0) { return true; + } else if ($versionDiff < 0) { + // downgrade attempt, throw exception + throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); } // also check for upgrades for apps (independently from the user) |