You are here

function linkchecker_clear_analyze_links_submit in Link checker 7

Same name and namespace in other branches
  1. 6.2 includes/linkchecker.admin.inc \linkchecker_clear_analyze_links_submit()

Submit callback.

Clear link data and analyze fields in all content types, comments, custom blocks.

1 call to linkchecker_clear_analyze_links_submit()
drush_linkchecker_clear in ./linkchecker.drush.inc
Callback for command linkchecker-analyze.
1 string reference to 'linkchecker_clear_analyze_links_submit'
linkchecker_admin_settings_form in ./linkchecker.admin.inc
Implements hook_admin_settings_form().

File

./linkchecker.admin.inc, line 339
Administrative page callbacks for the linkchecker module.

Code

function linkchecker_clear_analyze_links_submit($form, &$form_state) {

  // Exclude unnecessary elements.
  unset($form_state['values']['linkchecker_analyze'], $form_state['values']['linkchecker_clear_analyze']);

  // Save form settings.
  system_settings_form_submit($form, $form_state);
  db_truncate('linkchecker_block_custom')
    ->execute();
  db_truncate('linkchecker_comment')
    ->execute();
  db_truncate('linkchecker_node')
    ->execute();
  db_truncate('linkchecker_link')
    ->execute();

  // Start batch and analyze all nodes.
  $node_types = linkchecker_scan_node_types();
  if (!empty($node_types)) {
    module_load_include('inc', 'linkchecker', 'linkchecker.batch');
    batch_set(_linkchecker_batch_import_nodes($node_types));
  }
  $comment_types = linkchecker_scan_comment_types();
  if (!empty($comment_types)) {
    module_load_include('inc', 'linkchecker', 'linkchecker.batch');
    batch_set(_linkchecker_batch_import_comments($comment_types));
  }
  if (variable_get('linkchecker_scan_blocks', 0)) {
    module_load_include('inc', 'linkchecker', 'linkchecker.batch');
    batch_set(_linkchecker_batch_import_block_custom());
  }
}