You are here

function linkchecker_link_edit_form_submit in Link checker 6.2

Same name and namespace in other branches
  1. 5.2 linkchecker.module \linkchecker_link_edit_form_submit()
  2. 7 linkchecker.pages.inc \linkchecker_link_edit_form_submit()

File

includes/linkchecker.pages.inc, line 230
User page callbacks for the linkchecker module.

Code

function linkchecker_link_edit_form_submit($form, &$form_state) {

  // Force asap link re-check.
  if ($form_state['values']['recheck']) {
    db_query("UPDATE {linkchecker_links} SET last_checked = %d WHERE lid = %d", 0, $form_state['values']['lid']);
    drupal_set_message(t('The link %url will be checked again on the next cron run.', array(
      '%url' => $form_state['values']['url'],
    )));
  }
  if ($form_state['values']['method'] != $form['settings']['method']['#default_value']) {

    // Update settings and reset statistics for a quick re-check.
    db_query("UPDATE {linkchecker_links} SET method = '%s', fail_count = %d, last_checked = %d, status = %d WHERE lid = %d", $form_state['values']['method'], 0, 0, $form_state['values']['status'], $form_state['values']['lid']);
    drupal_set_message(t('The link settings for %url have been saved and the fail counter has been reset.', array(
      '%url' => $form_state['values']['url'],
    )));
  }
  else {

    // Update setting only.
    db_query("UPDATE {linkchecker_links} SET method = '%s', status = %d WHERE lid = %d", $form_state['values']['method'], $form_state['values']['status'], $form_state['values']['lid']);
    drupal_set_message(t('The link settings for %url have been saved.', array(
      '%url' => $form_state['values']['url'],
    )));
  }
}