Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
project
drupal
Commits
9a7899ef
Commit
9a7899ef
authored
Oct 05, 2010
by
webchick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#931190
by klausi, carlos8f: Fixed enabling modules via the UI breaks module dependencies.
parent
4b586bfe
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
1 deletion
+37
-1
modules/simpletest/tests/module_test.module
modules/simpletest/tests/module_test.module
+7
-0
modules/system/system.admin.inc
modules/system/system.admin.inc
+1
-1
modules/system/system.test
modules/system/system.test
+29
-0
No files found.
modules/simpletest/tests/module_test.module
View file @
9a7899ef
...
...
@@ -50,3 +50,10 @@ function module_test_hook_info() {
);
return
$hooks
;
}
/**
* Implements hook_modules_enabled().
*/
function
module_test_modules_enabled
(
$modules
)
{
variable_set
(
'test_module_enable_order'
,
$modules
);
}
modules/system/system.admin.inc
View file @
9a7899ef
...
...
@@ -1186,7 +1186,7 @@ function system_modules_submit($form, &$form_state) {
unset
(
$form_state
[
'storage'
]);
// Reverse the 'enable' list, to order dependencies before dependents.
rsort
(
$actions
[
'enable'
]);
k
rsort
(
$actions
[
'enable'
]);
// Installs, enables, and disables modules.
module_enable
(
$actions
[
'enable'
],
FALSE
);
...
...
modules/system/system.test
View file @
9a7899ef
...
...
@@ -318,6 +318,35 @@ class ModuleDependencyTestCase extends ModuleTestCase {
$this
->
assertText
(
t
(
'The configuration options have been saved.'
),
t
(
'Modules status has been updated.'
));
$this
->
assertModules
(
array
(
'taxonomy'
,
'forum'
),
TRUE
);
}
/**
* Tests that module dependencies are enabled in the correct order via the
* UI. Dependencies should be enabled before their dependents.
*/
function
testModuleEnableOrder
()
{
module_enable
(
array
(
'module_test'
),
FALSE
);
$this
->
resetAll
();
$this
->
assertModules
(
array
(
'module_test'
),
TRUE
);
variable_set
(
'dependency_test'
,
'dependency'
);
// module_test creates a dependency chain: forum depends on poll, which
// depends on php. The correct enable order is, php, poll, forum.
$expected_order
=
array
(
'php'
,
'poll'
,
'forum'
);
// Enable the modules through the UI, verifying that the dependency chain
// is correct.
$edit
=
array
();
$edit
[
'modules[Core][forum][enable]'
]
=
'forum'
;
$this
->
drupalPost
(
'admin/modules'
,
$edit
,
t
(
'Save configuration'
));
$this
->
assertModules
(
array
(
'forum'
),
FALSE
);
$this
->
assertText
(
t
(
'You must enable the Poll, PHP filter modules to install Forum.'
),
t
(
'Dependency chain created.'
));
$edit
[
'modules[Core][poll][enable]'
]
=
'poll'
;
$edit
[
'modules[Core][php][enable]'
]
=
'php'
;
$this
->
drupalPost
(
'admin/modules'
,
$edit
,
t
(
'Save configuration'
));
$this
->
assertModules
(
array
(
'forum'
,
'poll'
,
'php'
),
TRUE
);
// Check the actual order which is saved by module_test_modules_enabled().
$this
->
assertIdentical
(
variable_get
(
'test_module_enable_order'
,
FALSE
),
$expected_order
,
t
(
'Modules enabled in the correct order.'
));
}
}
/**
...
...
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