function system_modules_submit in Drupal 4
Same name and namespace in other branches
- 5 modules/system/system.module \system_modules_submit()
- 6 modules/system/system.admin.inc \system_modules_submit()
- 7 modules/system/system.admin.inc \system_modules_submit()
File
- modules/
system.module, line 988 - Configuration system that lets administrators modify the workings of the site.
Code
function system_modules_submit($form_id, $edit) {
db_query("UPDATE {system} SET status = 0, throttle = 0 WHERE type = 'module'");
$new_modules = array();
foreach ($edit['status'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET status = 1 WHERE type = 'module' AND name = '%s'", $key);
if (!module_exist($key)) {
$new_modules[] = $key;
}
}
}
if (is_array($edit['throttle'])) {
foreach ($edit['throttle'] as $key => $choice) {
if ($choice) {
db_query("UPDATE {system} SET throttle = 1 WHERE type = 'module' and name = '%s'", $key);
}
}
}
module_list(TRUE, FALSE);
include_once './includes/install.inc';
foreach ($new_modules as $module) {
// Set the installed schema version for newly-enabled modules
$versions = drupal_get_schema_versions($module);
if (drupal_get_installed_schema_version($module) == SCHEMA_UNINSTALLED) {
drupal_set_installed_schema_version($module, $versions ? max($versions) : SCHEMA_INSTALLED);
module_invoke($module, 'install');
}
}
menu_rebuild();
drupal_set_message(t('The configuration options have been saved.'));
return 'admin/modules';
}