| Versions | |
|---|---|
| 4.7 | system_modules_submit($form_id, |
| 5 | system_modules_submit( |
| 6 – 7 | system_modules_submit($form, &$form_state) |
modules/
<?php
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';
}
?>