You are here

function upgrade_assist_enable_modules_validate in Upgrade Status 6

Form submit handler to re-enable non-core modules.

File

upgrade_assist/upgrade_assist.module, line 718
Assists in upgrading Drupal.

Code

function upgrade_assist_enable_modules_validate($form, &$form_state) {
  if (!empty($form_state['values']['enable'])) {
    $modules = array_filter($form_state['values']['enable']);
    $status = module_enable($modules);
    if ($status === TRUE) {
      drupal_flush_all_caches();

      // Update the list of disabled modules.
      $module_info = variable_get('upgrade_assist_modules_disabled', array());
      $module_info = array_diff_key($module_info, $modules);
      variable_set('upgrade_assist_modules_disabled', $module_info);
      drupal_set_message(t('The selected modules have been re-enabled.'));
    }
    else {
      form_set_error('enable', t('The selected modules could not be re-enabled.'));
    }
  }
}