Skip to content
Snippets Groups Projects
Commit 4b3a3dc0 authored by Joas Schilling's avatar Joas Schilling
Browse files

Check new and old ways of required oC version for app compatibility

parent 9b742197
No related branches found
No related tags found
No related merge requests found
......@@ -1022,13 +1022,17 @@ class OC_App {
public static function isAppCompatible($ocVersion, $appInfo){
$requireMin = '';
$requireMax = '';
if (isset($appInfo['requiremin'])) {
if (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) {
$requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-version'];
} else if (isset($appInfo['requiremin'])) {
$requireMin = $appInfo['requiremin'];
} else if (isset($appInfo['require'])) {
$requireMin = $appInfo['require'];
}
if (isset($appInfo['requiremax'])) {
if (isset($appInfo['dependencies']['owncloud']['@attributes']['max-version'])) {
$requireMax = $appInfo['dependencies']['owncloud']['@attributes']['max-version'];
} else if (isset($appInfo['requiremax'])) {
$requireMax = $appInfo['requiremax'];
}
......
......@@ -182,6 +182,8 @@ class DependencyAnalyzer {
$minVersion = $dependencies['owncloud']['@attributes']['min-version'];
} elseif (isset($appInfo['requiremin'])) {
$minVersion = $appInfo['requiremin'];
} elseif (isset($appInfo['require'])) {
$minVersion = $appInfo['require'];
}
$maxVersion = null;
if (isset($dependencies['owncloud']['@attributes']['max-version'])) {
......
......@@ -112,7 +112,7 @@ class Test_App extends \Test\TestCase {
),
true
),
// multiple OC number
// multiple OC number
array(
'4.3.1',
array(
......@@ -120,7 +120,7 @@ class Test_App extends \Test\TestCase {
),
true
),
// single app number
// single app number
array(
'4',
array(
......@@ -208,6 +208,55 @@ class Test_App extends \Test\TestCase {
),
true
),
// dependencies versions before require*
array(
'6.0.0.0',
array(
'requiremin' => '5.0',
'requiremax' => '7.0',
'dependencies' => array(
'owncloud' => array(
'@attributes' => array(
'min-version' => '7.0',
'max-version' => '7.0',
),
),
),
),
false
),
array(
'6.0.0.0',
array(
'requiremin' => '5.0',
'requiremax' => '7.0',
'dependencies' => array(
'owncloud' => array(
'@attributes' => array(
'min-version' => '5.0',
'max-version' => '5.0',
),
),
),
),
false
),
array(
'6.0.0.0',
array(
'requiremin' => '5.0',
'requiremax' => '5.0',
'dependencies' => array(
'owncloud' => array(
'@attributes' => array(
'min-version' => '5.0',
'max-version' => '7.0',
),
),
),
),
true
),
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment