function _module_parse_info_file in Drupal 5
Parse Drupal info file format. Uses ini parser provided by php's parse_ini_file().
Files should use the ini format to specify values. e.g. key = "value" key2 = value2
Some things to be aware of:
- This function is NOT for placing arbitrary module-specific settings. Use variable_get() 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. package - The name of the package of modules this module belongs to.
Example of .info file: name = Forum description = Enables threaded discussions about general topics. dependencies = taxonomy comment package = Core - optional
Parameters
$filename: The file we are parsing. Accepts file with relative or absolute path.
Return value
The info array.
4 calls to _module_parse_info_file()
- help_page in modules/
help/ help.module - Menu callback; prints a page listing general help for all modules.
- module_rebuild_cache in includes/
module.inc - Rebuild the database cache of module files.
- system_modules_uninstall in modules/
system/ system.module - Builds a form of currently disabled modules.
- system_modules_uninstall_confirm_form in modules/
system/ system.module - Confirm uninstall of selected modules.
File
- includes/
module.inc, line 190 - API for loading and interacting with Drupal modules.
Code
function _module_parse_info_file($filename) {
$info = array();
if (file_exists($filename)) {
$info = parse_ini_file($filename);
if (isset($info['dependencies'])) {
$info['dependencies'] = explode(" ", $info['dependencies']);
}
else {
$info['dependencies'] = NULL;
}
}
return $info;
}