Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
5813cf32
Commit
5813cf32
authored
10 years ago
by
Lukas Reschke
Browse files
Options
Downloads
Patches
Plain Diff
Deduplicate dependency checks
Some code that I also used for
https://github.com/owncloud/administration/pull/11
parent
07b14bcd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/private/util.php
+42
-70
42 additions, 70 deletions
lib/private/util.php
with
42 additions
and
70 deletions
lib/private/util.php
+
42
−
70
View file @
5813cf32
...
@@ -493,78 +493,57 @@ class OC_Util {
...
@@ -493,78 +493,57 @@ class OC_Util {
);
);
}
}
// Contains the dependencies that should be checked against
// classes = class_exists
// functions = function_exists
// defined = defined
// If the dependency is not found the missing module name is shown to the EndUser
$dependencies
=
array
(
'classes'
=>
array
(
'ZipArchive'
=>
'zip'
,
'DOMDocument'
=>
'dom'
,
),
'functions'
=>
array
(
'xml_parser_create'
=>
'libxml'
,
'mb_detect_encoding'
=>
'mb multibyte'
,
'ctype_digit'
=>
'ctype'
,
'json_encode'
=>
'JSON'
,
'gd_info'
=>
'GD'
,
'gzencode'
=>
'zlib'
,
'iconv'
=>
'iconv'
,
'simplexml_load_string'
=>
'SimpleXML'
),
'defined'
=>
array
(
'PDO::ATTR_DRIVER_NAME'
=>
'PDO'
)
);
$missingDependencies
=
array
();
$moduleHint
=
$l
->
t
(
'Please ask your server administrator to install the module.'
);
$moduleHint
=
$l
->
t
(
'Please ask your server administrator to install the module.'
);
// check if all required php modules are present
if
(
!
class_exists
(
'ZipArchive'
))
{
foreach
(
$dependencies
[
'classes'
]
as
$class
=>
$module
)
{
$errors
[]
=
array
(
if
(
!
class_exists
(
$class
))
{
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'zip'
)),
$missingDependencies
[]
=
$module
;
'hint'
=>
$moduleHint
}
);
$webServerRestart
=
true
;
}
if
(
!
class_exists
(
'DOMDocument'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'dom'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(
!
function_exists
(
'xml_parser_create'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'libxml'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(
!
function_exists
(
'mb_detect_encoding'
))
{
$errors
[]
=
array
(
'error'
=>
'PHP module mb multibyte not installed.'
,
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(
!
function_exists
(
'ctype_digit'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'ctype'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(
!
function_exists
(
'json_encode'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'JSON'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(
!
extension_loaded
(
'gd'
)
||
!
function_exists
(
'gd_info'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'GD'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
}
if
(
!
function_exists
(
'gzencode'
))
{
foreach
(
$dependencies
[
'functions'
]
as
$function
=>
$module
)
{
$errors
[]
=
array
(
if
(
!
function_exists
(
$function
))
{
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'zlib'
)),
$missingDependencies
[]
=
$module
;
'hint'
=>
$moduleHint
}
);
$webServerRestart
=
true
;
}
}
if
(
!
function_exists
(
'iconv'
))
{
foreach
(
$dependencies
[
'defined'
]
as
$defined
=>
$module
)
{
$errors
[]
=
array
(
if
(
!
defined
(
$defined
))
{
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'iconv'
)),
$missingDependencies
[]
=
$module
;
'hint'
=>
$moduleHint
}
);
$webServerRestart
=
true
;
}
}
if
(
!
function_exists
(
'simplexml_load_string'
))
{
foreach
(
$missingDependencies
as
$missingDependency
)
{
$errors
[]
=
array
(
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'SimpleXML'
)),
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
$missingDependency
)),
'hint'
=>
$moduleHint
'hint'
=>
$moduleHint
);
);
$webServerRestart
=
true
;
$webServerRestart
=
true
;
}
}
if
(
version_compare
(
phpversion
(),
'5.3.3'
,
'<'
))
{
if
(
version_compare
(
phpversion
(),
'5.3.3'
,
'<'
))
{
$errors
[]
=
array
(
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP %s or higher is required.'
,
'5.3.3'
),
'error'
=>
$l
->
t
(
'PHP %s or higher is required.'
,
'5.3.3'
),
...
@@ -573,13 +552,6 @@ class OC_Util {
...
@@ -573,13 +552,6 @@ class OC_Util {
);
);
$webServerRestart
=
true
;
$webServerRestart
=
true
;
}
}
if
(
!
defined
(
'PDO::ATTR_DRIVER_NAME'
))
{
$errors
[]
=
array
(
'error'
=>
$l
->
t
(
'PHP module %s not installed.'
,
array
(
'PDO'
)),
'hint'
=>
$moduleHint
);
$webServerRestart
=
true
;
}
if
(((
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'on'
)
if
(((
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'on'
)
||
(
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'yes'
)
||
(
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'yes'
)
||
(
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'true'
)
||
(
strtolower
(
@
ini_get
(
'safe_mode'
))
==
'true'
)
...
...
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