summaryrefslogtreecommitdiff
path: root/includes/install.inc
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-12-13 10:46:43 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-12-13 10:46:43 +0000
commit050008410d34a78d93cac155476d359669a3cad7 (patch)
treed99fdabceb910603294b92b23be24c56cb62b033 /includes/install.inc
parenta64e5f38d1d662756ce9190db028773c7f90ddff (diff)
downloadbrdo-050008410d34a78d93cac155476d359669a3cad7.tar.gz
brdo-050008410d34a78d93cac155476d359669a3cad7.tar.bz2
#194010 by chx: Proper recursive dependency checking and ordering module installation in dependency order, so later installed modules can use previously installed module functionality
Diffstat (limited to 'includes/install.inc')
-rw-r--r--includes/install.inc18
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/install.inc b/includes/install.inc
index d68185e91..2ce311ee5 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -301,6 +301,24 @@ function drupal_verify_profile($profile, $locale) {
* The modules to install.
*/
function drupal_install_modules($module_list = array()) {
+ $files = module_rebuild_cache();
+ $module_list = array_flip(array_values($module_list));
+ do {
+ $moved = FALSE;
+ foreach ($module_list as $module => $weight) {
+ $file = $files[$module];
+ if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) {
+ foreach ($file->info['dependencies'] as $dependency) {
+ if (isset($module_list[$dependency]) && $module_list[$module] < $module_list[$dependency] +1) {
+ $module_list[$module] = $module_list[$dependency] +1;
+ $moved = TRUE;
+ }
+ }
+ }
+ }
+ } while ($moved);
+ asort($module_list);
+ $module_list = array_keys($module_list);
array_filter($module_list, '_drupal_install_module');
module_enable($module_list);
}