function module_rebuild_cache in Drupal 5
Same name and namespace in other branches
- 6 includes/module.inc \module_rebuild_cache()
Rebuild the database cache of module files.
Return value
The array of filesystem objects used to rebuild the cache.
4 calls to module_rebuild_cache()
- drupal_install_profile in includes/
install.inc - Install a profile (i.e. a set of modules) from scratch. The profile must be verified first using drupal_verify_profile().
- help_links_as_list in modules/
help/ help.module - system_admin_by_module in modules/
system/ system.module - Menu callback; prints a listing of admin tasks for each installed module.
- system_modules in modules/
system/ system.module - Menu callback; provides module enable/disable interface.
File
- includes/
module.inc, line 95 - API for loading and interacting with Drupal modules.
Code
function module_rebuild_cache() {
// Get current list of modules
$files = drupal_system_listing('\\.module$', 'modules', 'name', 0);
// Extract current files from database.
system_get_files_database($files, 'module');
ksort($files);
foreach ($files as $filename => $file) {
$file->info = _module_parse_info_file(dirname($file->filename) . '/' . $file->name . '.info');
// Skip modules that don't provide info.
if (empty($file->info)) {
unset($files[$filename]);
continue;
}
$files[$filename]->info = $file->info;
// log the critical hooks implemented by this module
$bootstrap = 0;
foreach (bootstrap_hooks() as $hook) {
if (module_hook($file->name, $hook)) {
$bootstrap = 1;
break;
}
}
// Update the contents of the system table:
// TODO: We shouldn't actually need this description field anymore. Remove me next release.
if (isset($file->status) || isset($file->old_filename) && $file->old_filename != $file->filename) {
db_query("UPDATE {system} SET description = '%s', name = '%s', filename = '%s', bootstrap = %d WHERE filename = '%s'", $file->info['description'], $file->name, $file->filename, $bootstrap, $file->old_filename);
}
else {
// This is a new module.
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;
}