Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
838ddc72
Commit
838ddc72
authored
10 years ago
by
Morris Jobke
Browse files
Options
Downloads
Plain Diff
Merge pull request #17348 from owncloud/fix-lower-than
Correct lower than wording
parents
7644c631
208985dc
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/private/app/dependencyanalyzer.php
+38
-11
38 additions, 11 deletions
lib/private/app/dependencyanalyzer.php
tests/lib/app/dependencyanalyzer.php
+26
-1
26 additions, 1 deletion
tests/lib/app/dependencyanalyzer.php
with
64 additions
and
12 deletions
lib/private/app/dependencyanalyzer.php
+
38
−
11
View file @
838ddc72
...
@@ -30,9 +30,10 @@ class DependencyAnalyzer {
...
@@ -30,9 +30,10 @@ class DependencyAnalyzer {
/** @var Platform */
/** @var Platform */
private
$platform
;
private
$platform
;
/** @var \OCP\IL10N */
/** @var \OCP\IL10N */
private
$l
;
private
$l
;
/** @var array */
private
$appInfo
;
/**
/**
* @param Platform $platform
* @param Platform $platform
...
@@ -47,7 +48,7 @@ class DependencyAnalyzer {
...
@@ -47,7 +48,7 @@ class DependencyAnalyzer {
* @param array $app
* @param array $app
* @returns array of missing dependencies
* @returns array of missing dependencies
*/
*/
public
function
analyze
(
$app
)
{
public
function
analyze
(
array
$app
)
{
$this
->
appInfo
=
$app
;
$this
->
appInfo
=
$app
;
if
(
isset
(
$app
[
'dependencies'
]))
{
if
(
isset
(
$app
[
'dependencies'
]))
{
$dependencies
=
$app
[
'dependencies'
];
$dependencies
=
$app
[
'dependencies'
];
...
@@ -61,11 +62,12 @@ class DependencyAnalyzer {
...
@@ -61,11 +62,12 @@ class DependencyAnalyzer {
$this
->
analyzeCommands
(
$dependencies
),
$this
->
analyzeCommands
(
$dependencies
),
$this
->
analyzeLibraries
(
$dependencies
),
$this
->
analyzeLibraries
(
$dependencies
),
$this
->
analyzeOS
(
$dependencies
),
$this
->
analyzeOS
(
$dependencies
),
$this
->
analyzeOC
(
$dependencies
,
$app
));
$this
->
analyzeOC
(
$dependencies
,
$app
)
);
}
}
/**
/**
* Truncates both verions to the lowest common version, e.g.
* Truncates both ver
s
ions to the lowest common version, e.g.
* 5.1.2.3 and 5.1 will be turned into 5.1 and 5.1,
* 5.1.2.3 and 5.1 will be turned into 5.1 and 5.1,
* 5.2.6.5 and 5.1 will be turned into 5.2 and 5.1
* 5.2.6.5 and 5.1 will be turned into 5.2 and 5.1
* @param string $first
* @param string $first
...
@@ -124,7 +126,11 @@ class DependencyAnalyzer {
...
@@ -124,7 +126,11 @@ class DependencyAnalyzer {
return
$this
->
compare
(
$first
,
$second
,
'<'
);
return
$this
->
compare
(
$first
,
$second
,
'<'
);
}
}
private
function
analyzePhpVersion
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzePhpVersion
(
array
$dependencies
)
{
$missing
=
[];
$missing
=
[];
if
(
isset
(
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
]))
{
if
(
isset
(
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
]))
{
$minVersion
=
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
];
$minVersion
=
$dependencies
[
'php'
][
'@attributes'
][
'min-version'
];
...
@@ -141,7 +147,11 @@ class DependencyAnalyzer {
...
@@ -141,7 +147,11 @@ class DependencyAnalyzer {
return
$missing
;
return
$missing
;
}
}
private
function
analyzeDatabases
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeDatabases
(
array
$dependencies
)
{
$missing
=
[];
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'database'
]))
{
if
(
!
isset
(
$dependencies
[
'database'
]))
{
return
$missing
;
return
$missing
;
...
@@ -164,7 +174,11 @@ class DependencyAnalyzer {
...
@@ -164,7 +174,11 @@ class DependencyAnalyzer {
return
$missing
;
return
$missing
;
}
}
private
function
analyzeCommands
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeCommands
(
array
$dependencies
)
{
$missing
=
[];
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'command'
]))
{
if
(
!
isset
(
$dependencies
[
'command'
]))
{
return
$missing
;
return
$missing
;
...
@@ -187,7 +201,11 @@ class DependencyAnalyzer {
...
@@ -187,7 +201,11 @@ class DependencyAnalyzer {
return
$missing
;
return
$missing
;
}
}
private
function
analyzeLibraries
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeLibraries
(
array
$dependencies
)
{
$missing
=
[];
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'lib'
]))
{
if
(
!
isset
(
$dependencies
[
'lib'
]))
{
return
$missing
;
return
$missing
;
...
@@ -225,7 +243,11 @@ class DependencyAnalyzer {
...
@@ -225,7 +243,11 @@ class DependencyAnalyzer {
return
$missing
;
return
$missing
;
}
}
private
function
analyzeOS
(
$dependencies
)
{
/**
* @param array $dependencies
* @return array
*/
private
function
analyzeOS
(
array
$dependencies
)
{
$missing
=
[];
$missing
=
[];
if
(
!
isset
(
$dependencies
[
'os'
]))
{
if
(
!
isset
(
$dependencies
[
'os'
]))
{
return
$missing
;
return
$missing
;
...
@@ -249,7 +271,12 @@ class DependencyAnalyzer {
...
@@ -249,7 +271,12 @@ class DependencyAnalyzer {
return
$missing
;
return
$missing
;
}
}
private
function
analyzeOC
(
$dependencies
,
$appInfo
)
{
/**
* @param array $dependencies
* @param array $appInfo
* @return array
*/
private
function
analyzeOC
(
array
$dependencies
,
array
$appInfo
)
{
$missing
=
[];
$missing
=
[];
$minVersion
=
null
;
$minVersion
=
null
;
if
(
isset
(
$dependencies
[
'owncloud'
][
'@attributes'
][
'min-version'
]))
{
if
(
isset
(
$dependencies
[
'owncloud'
][
'@attributes'
][
'min-version'
]))
{
...
@@ -273,7 +300,7 @@ class DependencyAnalyzer {
...
@@ -273,7 +300,7 @@ class DependencyAnalyzer {
}
}
if
(
!
is_null
(
$maxVersion
))
{
if
(
!
is_null
(
$maxVersion
))
{
if
(
$this
->
compareBigger
(
$this
->
platform
->
getOcVersion
(),
$maxVersion
))
{
if
(
$this
->
compareBigger
(
$this
->
platform
->
getOcVersion
(),
$maxVersion
))
{
$missing
[]
=
(
string
)
$this
->
l
->
t
(
'ownCloud
with a version lower than %s
is required.'
,
$maxVersion
);
$missing
[]
=
(
string
)
$this
->
l
->
t
(
'ownCloud
%s or lower
is required.'
,
$maxVersion
);
}
}
}
}
return
$missing
;
return
$missing
;
...
...
This diff is collapsed.
Click to expand it.
tests/lib/app/dependencyanalyzer.php
+
26
−
1
View file @
838ddc72
...
@@ -68,6 +68,10 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -68,6 +68,10 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
/**
/**
* @dataProvider providesPhpVersion
* @dataProvider providesPhpVersion
*
* @param string $expectedMissing
* @param string $minVersion
* @param string $maxVersion
*/
*/
public
function
testPhpVersion
(
$expectedMissing
,
$minVersion
,
$maxVersion
)
{
public
function
testPhpVersion
(
$expectedMissing
,
$minVersion
,
$maxVersion
)
{
$app
=
array
(
$app
=
array
(
...
@@ -106,6 +110,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -106,6 +110,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
/**
/**
* @dataProvider providesCommands
* @dataProvider providesCommands
*
* @param string $expectedMissing
* @param string|null $commands
*/
*/
public
function
testCommand
(
$expectedMissing
,
$commands
)
{
public
function
testCommand
(
$expectedMissing
,
$commands
)
{
$app
=
array
(
$app
=
array
(
...
@@ -179,6 +186,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -179,6 +186,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
$this
->
assertEquals
(
$expectedMissing
,
$missing
);
$this
->
assertEquals
(
$expectedMissing
,
$missing
);
}
}
/**
* @return array
*/
function
providesOC
()
{
function
providesOC
()
{
return
array
(
return
array
(
// no version -> no missing dependency
// no version -> no missing dependency
...
@@ -188,10 +198,13 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -188,10 +198,13 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
array
(
array
(),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'8.0.2'
,
'max-version'
=>
'8.0.2'
))),
array
(
array
(),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'8.0.2'
,
'max-version'
=>
'8.0.2'
))),
array
(
array
(
'ownCloud 8.0.3 or higher is required.'
),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'8.0.3'
))),
array
(
array
(
'ownCloud 8.0.3 or higher is required.'
),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'8.0.3'
))),
array
(
array
(
'ownCloud 9 or higher is required.'
),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'9'
))),
array
(
array
(
'ownCloud 9 or higher is required.'
),
array
(
'@attributes'
=>
array
(
'min-version'
=>
'9'
))),
array
(
array
(
'ownCloud with a version lower than 8.0.1
is required.'
)
,
array
(
'@attributes'
=>
array
(
'max-version'
=>
'8.0.1'
)))
,
[[
'ownCloud 8.0.1 or lower
is required.'
]
,
[
'@attributes'
=>
[
'max-version'
=>
'8.0.1'
]]]
,
);
);
}
}
/**
* @return array
*/
function
providesOS
()
{
function
providesOS
()
{
return
array
(
return
array
(
array
(
array
(),
null
),
array
(
array
(),
null
),
...
@@ -201,6 +214,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -201,6 +214,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
);
}
}
/**
* @return array
*/
function
providesLibs
()
{
function
providesLibs
()
{
return
array
(
return
array
(
// we expect curl to exist
// we expect curl to exist
...
@@ -226,6 +242,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -226,6 +242,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
);
}
}
/**
* @return array
*/
function
providesCommands
()
{
function
providesCommands
()
{
return
array
(
return
array
(
array
(
array
(),
null
),
array
(
array
(),
null
),
...
@@ -240,6 +259,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -240,6 +259,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
);
}
}
/**
* @return array
*/
function
providesDatabases
()
{
function
providesDatabases
()
{
return
array
(
return
array
(
// non BC - in case on databases are defined -> all are supported
// non BC - in case on databases are defined -> all are supported
...
@@ -250,6 +272,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
...
@@ -250,6 +272,9 @@ class DependencyAnalyzer extends \PHPUnit_Framework_TestCase {
);
);
}
}
/**
* @return array
*/
function
providesPhpVersion
()
{
function
providesPhpVersion
()
{
return
array
(
return
array
(
array
(
array
(),
null
,
null
),
array
(
array
(),
null
,
null
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment