function system_modules_uninstall in Drupal 6
Same name and namespace in other branches
- 5 modules/system/system.module \system_modules_uninstall()
- 7 modules/system/system.admin.inc \system_modules_uninstall()
Builds a form of currently disabled modules.
Parameters
$form_state['values']: Submitted form values.
Return value
A form array representing the currently disabled modules.
See also
system_modules_uninstall_validate()
system_modules_uninstall_submit()
Related topics
1 string reference to 'system_modules_uninstall'
- system_menu in modules/
system/ system.module - Implementation of hook_menu().
File
- modules/
system/ system.admin.inc, line 1028 - Admin page callbacks for the system module.
Code
function system_modules_uninstall($form_state = NULL) {
// Make sure the install API is available.
include_once './includes/install.inc';
// Display the confirm form if any modules have been submitted.
if (isset($form_state) && ($confirm_form = system_modules_uninstall_confirm_form($form_state['storage']))) {
return $confirm_form;
}
$form = array();
// Pull all disabled modules from the system table.
$disabled_modules = db_query("SELECT name, filename, info 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 module info
$info = unserialize($module->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 (!empty($options)) {
$form['uninstall'] = array(
'#type' => 'checkboxes',
'#options' => $options,
);
$form['buttons']['submit'] = array(
'#type' => 'submit',
'#value' => t('Uninstall'),
);
$form['#action'] = url('admin/build/modules/uninstall/confirm');
}
else {
$form['modules'] = array();
}
return $form;
}