Throw exception on downgrade attempt
This commit is contained in:
parent
2b08659f7d
commit
d5b0b55eef
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue