You are here

function _linkchecker_batch_import_comments in Link checker 6.2

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

Batch: Scan comments for links.

3 calls to _linkchecker_batch_import_comments()
linkchecker_admin_settings_form_submit in includes/linkchecker.admin.inc
linkchecker_analyze_links_submit in includes/linkchecker.admin.inc
Submit callback; Analyze all node types, boxes and cck fields.
linkchecker_clear_analyze_links_submit in includes/linkchecker.admin.inc
Submit callback; Clear link data and analyze all node types, boxes and cck fields.

File

includes/linkchecker.batch.inc, line 57
Batch API callbacks for the linkchecker module.

Code

function _linkchecker_batch_import_comments($node_types = array()) {

  // Get all active {comments}.cid's.
  $result = db_query('SELECT c.cid FROM {comments} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.status = %d AND n.status = %d AND n.type IN (' . db_placeholders($node_types, 'varchar') . ') ORDER BY c.cid', array_merge(array(
    COMMENT_PUBLISHED,
    1,
  ), $node_types));
  $operations = array();
  while ($row = db_fetch_array($result)) {
    $operations[] = array(
      '_linkchecker_batch_comments_import_op',
      array(
        $row['cid'],
      ),
    );
  }
  $batch = array(
    'file' => drupal_get_path('module', 'linkchecker') . '/includes/linkchecker.batch.inc',
    'finished' => '_linkchecker_batch_comments_import_finished',
    'operations' => $operations,
    'title' => t('Scanning for links'),
  );
  return $batch;
}