function fetch_module_weights in Util 6.2
Same name and namespace in other branches
- 6.3 module_weights.module \fetch_module_weights()
Helper function to fetch and cache module weights.
3 calls to fetch_module_weights()
File
- ./
module_weights.module, line 50 - Allows module weights to be viewed and edited.
Code
function fetch_module_weights($name = NULL) {
static $module_weights = array();
if (empty($module_weights)) {
$query = "SELECT filename, name, type, owner, status, throttle, bootstrap, schema_version, weight FROM {system} WHERE type = 'module' ORDER BY name";
$result = db_query($query);
while ($row = db_fetch_object($result)) {
$module_weights[$row->name] = $row->weight;
}
}
if ($name === NULL) {
return $module_weights;
}
elseif (isset($module_weights[$name])) {
return $module_weights[$name];
}
else {
return NULL;
}
}