Commit f24e304f authored by Steven Wittens's avatar Steven Wittens

#84875: Dependency system for core

parent 96533c93
......@@ -130,7 +130,30 @@ function module_rebuild_cache() {
db_query("INSERT INTO {system} (name, description, type, filename, status, throttle, bootstrap) VALUES ('%s', '%s', '%s', '%s', %d, %d, %d)", $file->name, $file->info['description'], 'module', $file->filename, $file->status, $file->throttle, $bootstrap);
}
}
$files = _module_build_dependents($files);
return $files;
}
/**
* Find dependents; modules that are required by other modules.
* Adds an array of dependents to the $file->info array.
*
* @return
* The list of files array with dependents added where applicable.
*/
function _module_build_dependents($files) {
foreach ($files as $filename => $file) {
if (is_array($file->info['dependencies'])) {
foreach ($file->info['dependencies'] as $dependency) {
if (!empty($files[$dependency]) && is_array($files[$dependency]->info)) {
if (!isset($files[$dependency]->info['dependents'])) {
$files[$dependency]->info['dependents'] = array();
}
$files[$dependency]->info['dependents'][] = $filename;
}
}
}
}
return $files;
}
......@@ -148,8 +171,18 @@ function module_rebuild_cache() {
* and variable_set() for that.
* - You may not use double-quotes in a value.
*
* Information stored in the module.info file:
* name - The real name of the module for display purposes.
* description - A brief description of the module.
* dependencies - A space delimited list of the short names (shortname) of other modules this module depends on.
*
* Example of .info file:
* name = Forum
* description = Enables threaded discussions about general topics.
* dependencies = taxonomy comment
*
* @param $filename
* The file we are parsing. Accepts file with relative or absolute path.
* The file we are parsing. Accepts file with relative or absolute path.
* @return
* The info array.
*/
......@@ -159,6 +192,9 @@ function _module_parse_info_file($filename) {
if (file_exists($filename)) {
$info = parse_ini_file($filename);
}
if (isset($info['dependencies'])) {
$info['dependencies'] = explode(" ", $info['dependencies']);
}
return $info;
}
......
; $Id$
name = Forum
description = Enables threaded discussions about general topics.
dependencies = taxonomy comment
......@@ -39,6 +39,20 @@ div.admin .expert-link {
padding-right: 4px;
}
div.admin-dependencies, div.admin-required {
font-size: 0.9em;
color: #444;
}
span.admin-disabled {
color: #800;
}
span.admin-enabled {
color: #080;
}
span.admin-missing {
color: #f00;
}
/**
* Formatting for status report
*/
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment