system_modules_submit

Versions
4.7
system_modules_submit($form_id, $edit)
5
system_modules_submit($form_id, $form_values)
6 – 7
system_modules_submit($form, &$form_state)

Code

modules/system.module, line 988

<?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';
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.