function linkchecker_admin_settings_form_submit in Link checker 5.2
Same name and namespace in other branches
- 6.2 includes/linkchecker.admin.inc \linkchecker_admin_settings_form_submit()
- 7 linkchecker.admin.inc \linkchecker_admin_settings_form_submit()
File
- ./linkchecker.module, line 347
- This module periodically check links in given node types, blocks, cck fields, etc.
Code
function linkchecker_admin_settings_form_submit($form_id, $form_values) {
unset($form_values['linkchecker_analyze'], $form_values['linkchecker_clear_analyze']);
switch ($form_values['op']) {
case t('Analyze content for links'):
system_settings_form_submit($form_id, $form_values);
_linkchecker_batch_import();
drupal_set_message(t('Content analysis has been queued for processing via cron.'));
drupal_goto('admin/settings/linkchecker');
break;
case t('Clear link data and analyze content for links'):
system_settings_form_submit($form_id, $form_values);
db_query("TRUNCATE TABLE {linkchecker_nodes}");
db_query("TRUNCATE TABLE {linkchecker_comments}");
db_query("TRUNCATE TABLE {linkchecker_boxes}");
db_query("TRUNCATE TABLE {linkchecker_links}");
db_query("DELETE FROM {sequences} WHERE name = '%s'", 'linkchecker_links_lid');
_linkchecker_batch_import();
drupal_set_message(t('Cleared link data and content analysis has been queued for processing via cron.'));
drupal_goto('admin/settings/linkchecker');
break;
default:
$additional_nodetypes_selected = array_diff($form_values['linkchecker_scan_nodetypes'], variable_get('linkchecker_scan_nodetypes', array()));
$linkchecker_scan_comments_changed = $form_values['linkchecker_scan_comments'] > variable_get('linkchecker_scan_comments', 0) ? TRUE : FALSE;
$linkchecker_scan_blocks = $form_values['linkchecker_scan_blocks'] > variable_get('linkchecker_scan_blocks', 0) ? TRUE : FALSE;
system_settings_form_submit($form_id, $form_values);
if (!empty($additional_nodetypes_selected) || $linkchecker_scan_comments_changed) {
$node_types = array_keys(array_filter($form_values['linkchecker_scan_nodetypes']));
if (!empty($node_types)) {
_linkchecker_batch_import_nodes($node_types);
drupal_set_message(t('Node types analysis have been queued for processing via cron.'));
if ($linkchecker_scan_comments_changed) {
_linkchecker_batch_import_comments($node_types);
drupal_set_message(t('Comment analysis has been queued for processing via cron.'));
}
}
}
if ($linkchecker_scan_blocks) {
_linkchecker_batch_import_boxes();
drupal_set_message(t('Block analysis has been queued for processing via cron.'));
}
}
}