This patch makes the module_enable and module_disable function more robust.
This patch replaces _module_build_dependencies as that implementation was a little awkward in calculating only a two levels deep list of dependencies. And it makes building the graph impossible by adding all levels dependencies instead of one level needed to build a graph.
Unit tests are included for all new functions and for enabling and disabling modules.
module_enable and module_disable have now a guard to calculate all dependant modules based on the list of given modules.
In order to accomplish this a graph is build based on de modules installed. From this graph a Topological Sorted List (TSL for short) is generated.
Functional the frontend aka admin/build/modules should use the following to list all 'depends on' and 'required by' modules.
$depends_on = module_get_tsl( $module, TRUE); $required_by_dependencies = module_get_tsl( $module, FALSE);
Note that the frontend will not break by this patch. The lists are now only smaller. But module_enable and module_disable don't care any more.
Futhermore this patch renders drush_mm module obsolete and provides probably a solution forby giving a TSL for updating.
Applying this test makesobsolete.