Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
die_coolen_jungs
our_own_cloud_project
Commits
5f9700cc
Commit
5f9700cc
authored
Apr 29, 2016
by
Lukas Reschke
Browse files
Merge pull request #24317 from owncloud/app-require-bits
Allow app developers to specify the minimum int size
parents
1f63e8df
4c1b55be
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/private/App/DependencyAnalyzer.php
View file @
5f9700cc
...
...
@@ -145,6 +145,12 @@ class DependencyAnalyzer {
$missing
[]
=
(
string
)
$this
->
l
->
t
(
'PHP with a version lower than %s is required.'
,
$maxVersion
);
}
}
if
(
isset
(
$dependencies
[
'php'
][
'@attributes'
][
'min-int-size'
]))
{
$intSize
=
$dependencies
[
'php'
][
'@attributes'
][
'min-int-size'
];
if
(
$intSize
>
$this
->
platform
->
getIntSize
()
*
8
)
{
$missing
[]
=
(
string
)
$this
->
l
->
t
(
'%sbit or higher PHP required.'
,
$intSize
);
}
}
return
$missing
;
}
...
...
lib/private/App/Platform.php
View file @
5f9700cc
...
...
@@ -48,6 +48,13 @@ class Platform {
return
phpversion
();
}
/**
* @return int
*/
public
function
getIntSize
()
{
return
PHP_INT_SIZE
;
}
/**
* @return string
*/
...
...
tests/lib/app/dependencyanalyzer.php
View file @
5f9700cc
...
...
@@ -32,6 +32,9 @@ class DependencyAnalyzer extends TestCase {
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
'getPhpVersion'
)
->
will
(
$this
->
returnValue
(
'5.4.3'
));
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
'getIntSize'
)
->
will
(
$this
->
returnValue
(
'4'
));
$this
->
platformMock
->
expects
(
$this
->
any
())
->
method
(
'getDatabase'
)
->
will
(
$this
->
returnValue
(
'mysql'
));
...
...
@@ -73,8 +76,9 @@ class DependencyAnalyzer extends TestCase {
* @param string $expectedMissing
* @param string $minVersion
* @param string $maxVersion
* @param string $intSize
*/
public
function
testPhpVersion
(
$expectedMissing
,
$minVersion
,
$maxVersion
)
{
public
function
testPhpVersion
(
$expectedMissing
,
$minVersion
,
$maxVersion
,
$intSize
)
{
$app
=
array
(
'dependencies'
=>
array
(
'php'
=>
array
()
...
...
@@ -86,6 +90,9 @@ class DependencyAnalyzer extends TestCase {
if
(
!
is_null
(
$maxVersion
))
{
$app
[
'dependencies'
][
'php'
][
'@attributes'
][
'max-version'
]
=
$maxVersion
;
}
if
(
!
is_null
(
$intSize
))
{
$app
[
'dependencies'
][
'php'
][
'@attributes'
][
'min-int-size'
]
=
$intSize
;
}
$missing
=
$this
->
analyser
->
analyze
(
$app
);
$this
->
assertTrue
(
is_array
(
$missing
));
...
...
@@ -278,13 +285,14 @@ class DependencyAnalyzer extends TestCase {
*/
function
providesPhpVersion
()
{
return
array
(
array
(
array
(),
null
,
null
),
array
(
array
(),
'5.4'
,
null
),
array
(
array
(),
null
,
'5.5'
),
array
(
array
(),
'5.4'
,
'5.5'
),
array
(
array
(
'PHP 5.4.4 or higher is required.'
),
'5.4.4'
,
null
),
array
(
array
(
'PHP with a version lower than 5.4.2 is required.'
),
null
,
'5.4.2'
),
array
(
array
(),
'5.4'
,
'5.4'
),
array
(
array
(),
null
,
null
,
null
),
array
(
array
(),
'5.4'
,
null
,
null
),
array
(
array
(),
null
,
'5.5'
,
null
),
array
(
array
(),
'5.4'
,
'5.5'
,
null
),
array
(
array
(
'PHP 5.4.4 or higher is required.'
),
'5.4.4'
,
null
,
null
),
array
(
array
(
'PHP with a version lower than 5.4.2 is required.'
),
null
,
'5.4.2'
,
null
),
array
(
array
(
'64bit or higher PHP required.'
),
null
,
null
,
64
),
array
(
array
(),
'5.4'
,
'5.4'
,
null
),
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment