Determines which modules require and are required by each module.
$files: The array of filesystem objects used to rebuild the cache.
The same array with the new keys for each module:
function _module_build_dependencies($files) {
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;
}
}
}
$graph_object = new Graph($graph);
$graph = $graph_object
->searchAndSort();
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;
}