Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
c80f7397
Commit
c80f7397
authored
Sep 14, 2007
by
Dries Buytaert
Browse files
- Patch
#168487
by douggreen: don't enable modules that depend on incompabitlbe modules.
parent
75468bd0
Changes
1
Hide whitespace changes
Inline
Side-by-side
modules/system/system.admin.inc
View file @
c80f7397
...
...
@@ -525,6 +525,22 @@ function system_theme_settings_submit($form, &$form_state) {
cache_clear_all
();
}
/**
* Recursively check compatability
*/
function
_system_is_incompatible
(
&
$incompatible
,
$files
,
$file
)
{
if
(
isset
(
$incompatible
[
$file
->
name
]))
{
return
TRUE
;
}
// Recursively traverse the dependencies, looking for incompatible modules
foreach
(
$file
->
info
[
'dependencies'
]
as
$dependency
)
{
if
(
isset
(
$files
[
$dependency
])
&&
_system_is_incompatible
(
$incompatible
,
$files
,
$files
[
$dependency
]))
{
$incompatible
[
$file
->
name
]
=
TRUE
;
return
TRUE
;
}
}
}
/**
* Menu callback; provides module enable/disable interface.
*
...
...
@@ -557,27 +573,31 @@ function system_modules($form_state = array()) {
// Create storage for disabled modules as browser will disable checkboxes.
$form
[
'disabled_modules'
]
=
array
(
'#type'
=>
'value'
,
'#value'
=>
array
());
// Array for disabling checkboxes in callback system_module_disable.
$disabled
=
array
();
$throttle
=
array
();
// Traverse the files, checking for compatibility
$incompatible_core
=
array
();
$incompatible_php
=
array
();
// Traverse the files retrieved and build the form.
foreach
(
$files
as
$filename
=>
$file
)
{
$form
[
'name'
][
$filename
]
=
array
(
'#value'
=>
$file
->
info
[
'name'
]);
$form
[
'version'
][
$filename
]
=
array
(
'#value'
=>
$file
->
info
[
'version'
]);
$form
[
'description'
][
$filename
]
=
array
(
'#value'
=>
t
(
$file
->
info
[
'description'
]));
$options
[
$filename
]
=
''
;
// Ensure this module is compatible with this version of core.
if
(
!
isset
(
$file
->
info
[
'core'
])
||
$file
->
info
[
'core'
]
!=
DRUPAL_CORE_COMPATIBILITY
)
{
$incompatible_core
[]
=
$file
->
name
;
$disabled
[]
=
$file
->
name
;
// Nothing else in this loop matters, so move to the next module.
continue
;
$incompatible_core
[
$file
->
name
]
=
$file
->
name
;
}
// Ensure this module is compatible with the currently installed version of PHP.
if
(
version_compare
(
phpversion
(),
$file
->
info
[
'php'
])
<
0
)
{
$incompatible_php
[
$file
->
name
]
=
$file
->
info
[
'php'
];
}
}
// Array for disabling checkboxes in callback system_module_disable.
$disabled
=
array
();
$throttle
=
array
();
// Traverse the files retrieved and build the form.
foreach
(
$files
as
$filename
=>
$file
)
{
$form
[
'name'
][
$filename
]
=
array
(
'#value'
=>
$file
->
info
[
'name'
]);
$form
[
'version'
][
$filename
]
=
array
(
'#value'
=>
$file
->
info
[
'version'
]);
$form
[
'description'
][
$filename
]
=
array
(
'#value'
=>
t
(
$file
->
info
[
'description'
]));
$options
[
$filename
]
=
''
;
// Ensure this module is compatible with this version of core and php.
if
(
_system_is_incompatible
(
$incompatible_core
,
$files
,
$file
)
||
_system_is_incompatible
(
$incompatible_php
,
$files
,
$file
))
{
$disabled
[]
=
$file
->
name
;
// Nothing else in this loop matters, so move to the next module.
continue
;
...
...
@@ -659,7 +679,7 @@ function system_modules($form_state = array()) {
'system_modules_disable'
,
),
'#disabled_modules'
=>
$disabled
,
'#incompatible_modules_core'
=>
drupal_map_assoc
(
$incompatible_core
)
,
'#incompatible_modules_core'
=>
$incompatible_core
,
'#incompatible_modules_php'
=>
$incompatible_php
,
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment