You are here

function update_status_settings_submit in Update Status 5.2

Same name and namespace in other branches
  1. 5 update_status.module \update_status_settings_submit()

Submit callback handler for the update status settings tab.

Saves all the settings to the database.

Also invalidates the cache of available updates if the "Check for updates of disabled modules" setting is being changed. Both the advanced settings table and the available updates report need to refetch available update data after this setting changes or they're going to show misleading things (for example, listing all of the disabled projects on the site with the "No available releases found" warning).

See also

update_status_settings()

File

./update_status.module, line 375

Code

function update_status_settings_submit($form_id, $form_values) {
  variable_set('update_status_check_frequency', $form_values['check_frequency']);
  variable_set('update_status_notification_threshold', $form_values['notification_threshold']);
  if (empty($form_values['notify_emails'])) {
    variable_del('update_status_notify_emails');
  }
  else {
    $emails = array();
    foreach (explode("\n", trim($form_values['notify_emails'])) as $email) {
      $email = trim($email);
      if (!empty($email)) {
        $emails[] = $email;
      }
    }
    variable_set('update_status_notify_emails', $emails);
  }
  variable_set('update_status_settings', $form_values['projects']);

  // See if the update_status_check_disabled setting is being enabled, and
  // if so, invalidate all cached update status data.
  $check_disabled = variable_get('update_status_check_disabled', FALSE);
  if ($form_values['update_status_check_disabled'] != $check_disabled) {
    update_status_invalidate_cache();
  }
  variable_set('update_status_check_disabled', $form_values['update_status_check_disabled']);
  drupal_set_message(t('Your changes have been saved.'));
}