system_modules_uninstall
modules/system/system.module, строка 1598
- Версии
- 5
system_modules_uninstall(
$form_values= NULL)- 6
system_modules_uninstall($form_state = NULL)
Builds a form of currently disabled modules.
Параметры
$form_values
Submitted form values.
Возвращаемое значение
A form array representing the currently disabled modules.
Код
<?php
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;
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии