diff --git a/includes/module.inc b/includes/module.inc index 23f2fa8..d8a9cd0 100644 --- a/includes/module.inc +++ b/includes/module.inc @@ -202,39 +202,6 @@ function system_list_reset() { } /** - * Find dependencies any level deep and fill in required by information too. - * - * @param $files - * The array of filesystem objects used to rebuild the cache. - * - * @return - * The same array with the new keys for each module: - * - requires: An array with the keys being the modules that this module - * requires. - * - required_by: An array with the keys being the modules that will not work - * without this module. - */ -function _module_build_dependencies($files) { - require_once DRUPAL_ROOT . '/includes/graph.inc'; - foreach ($files as $filename => $file) { - $graph[$file->name]['edges'] = array(); - if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) { - foreach ($file->info['dependencies'] as $dependency) { - $dependency_data = drupal_parse_dependency($dependency); - $graph[$file->name]['edges'][$dependency_data['name']] = $dependency_data; - } - } - } - drupal_depth_first_search($graph); - foreach ($graph as $module => $data) { - $files[$module]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); - $files[$module]->requires = isset($data['paths']) ? $data['paths'] : array(); - $files[$module]->sort = $data['weight']; - } - return $files; -} - -/** * Determine whether a given module exists. * * @param $module diff --git a/modules/system/system.module b/modules/system/system.module index 3ebc657..e0e28a4 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -2415,13 +2415,51 @@ function system_rebuild_module_data() { ksort($modules); system_get_files_database($modules, 'module'); system_update_files_database($modules, 'module'); - $modules = _module_build_dependencies($modules); + $modules = _system_build_dependencies($modules); $modules_cache = $modules; } return $modules_cache; } /** + * Find dependencies any level deep and fill in required by information too. + * + * @param $files + * The array of filesystem objects used to rebuild the cache. + * @param $dependency_files + * The array of filesystem objects for additional available dependencies. + * + * @return + * The same array with the new keys for each module: + * - requires: An array with the keys being the modules that this module + * requires. + * - required_by: An array with the keys being the modules that will not work + * without this module. + */ +function _system_build_dependencies($files, $dependency_files = array()) { + require_once DRUPAL_ROOT . '/includes/graph.inc'; + $graph_files = array_merge($files, $dependency_files); + foreach ($graph_files as $filename => $file) { + $graph[$file->name]['edges'] = array(); + if (isset($file->info['dependencies']) && is_array($file->info['dependencies'])) { + foreach ($file->info['dependencies'] as $dependency) { + $dependency_data = drupal_parse_dependency($dependency); + $graph[$file->name]['edges'][$dependency_data['name']] = $dependency_data; + } + } + } + drupal_depth_first_search($graph); + foreach ($graph as $project => $data) { + if (isset($files[$project])) { + $files[$project]->required_by = isset($data['reverse_paths']) ? $data['reverse_paths'] : array(); + $files[$project]->requires = isset($data['paths']) ? $data['paths'] : array(); + $files[$project]->sort = $data['weight']; + } + } + return $files; +} + +/** * Refresh bootstrap column in the system table. * * This is called internally by module_enable/disable() to flag modules that @@ -2563,6 +2601,8 @@ function system_rebuild_theme_data() { ksort($themes); system_get_files_database($themes, 'theme'); system_update_files_database($themes, 'theme'); + $modules = system_rebuild_module_data(); + $themes = _system_build_dependencies($themes, $modules); return $themes; }