function system_modules_uninstall in Drupal 5
Same name and namespace in other branches
- 6 modules/system/system.admin.inc \system_modules_uninstall()
- 7 modules/system/system.admin.inc \system_modules_uninstall()
Builds a form of currently disabled modules.
Parameters
$form_values Submitted form values.:
Return value
A form array representing the currently disabled modules.
1 string reference to 'system_modules_uninstall'
- system_menu in modules/
system/ system.module - Implementation of hook_menu().
File
- modules/
system/ system.module, line 1598 - Configuration system that lets administrators modify the workings of the site.
Code
function system_modules_uninstall($form_values = NULL) {
// Make sure the install API is available.
include_once './includes/install.inc';
// Display the confirm form if any modules have been submitted.
if ($confirm_form = system_modules_uninstall_confirm_form($form_values)) {
return $confirm_form;
}
$form = array();
// Pull all disabled modules from the system table.
$disabled_modules = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 0 AND schema_version > %d ORDER BY name", SCHEMA_UNINSTALLED);
while ($module = db_fetch_object($disabled_modules)) {
// Grab the .info file and set name and description.
$info = _module_parse_info_file(dirname($module->filename) . '/' . $module->name . '.info');
// Load the .install file, and check for an uninstall hook.
// If the hook exists, the module can be uninstalled.
module_load_install($module->name);
if (module_hook($module->name, 'uninstall')) {
$form['modules'][$module->name]['name'] = array(
'#value' => $info['name'] ? $info['name'] : $module->name,
);
$form['modules'][$module->name]['description'] = array(
'#value' => t($info['description']),
);
$options[$module->name] = '';
}
}
// Only build the rest of the form if there are any modules available to uninstall.
if (count($options)) {
$form['uninstall'] = array(
'#type' => 'checkboxes',
'#options' => $options,
);
$form['buttons']['submit'] = array(
'#type' => 'button',
'#value' => t('Uninstall'),
);
$form['#multistep'] = TRUE;
$form['#action'] = url('admin/build/modules/uninstall/confirm');
}
return $form;
}