You are here

function _linkchecker_batch_import_comments in Link checker 5.2

Same name and namespace in other branches
  1. 6.2 includes/linkchecker.batch.inc \_linkchecker_batch_import_comments()
  2. 7 linkchecker.batch.inc \_linkchecker_batch_import_comments()

Batch: Load all comments 100 by hundred.

2 calls to _linkchecker_batch_import_comments()
linkchecker_admin_settings_form_submit in ./linkchecker.module
_linkchecker_batch_import in ./linkchecker.module
Trigger batch import job.

File

./linkchecker.module, line 611
This module periodically check links in given node types, blocks, cck fields, etc.

Code

function _linkchecker_batch_import_comments($node_types = array()) {

  // Comment import count.
  $placeholders = implode(',', array_fill(0, count($node_types), "'%s'"));
  $rows = db_result(db_query('SELECT COUNT(DISTINCT 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 (' . $placeholders . ')', array_merge(array(
    COMMENT_NOT_PUBLISHED,
    1,
  ), $node_types)));
  for ($row = 0; $row < $rows; $row = $row + LINKCHECKER_SCAN_MAX_LINKS_PER_RUN) {
    job_queue_add('_linkchecker_batch_comments_import_op', 'Scan comments from row ' . $row . ' to ' . ($row + LINKCHECKER_SCAN_MAX_LINKS_PER_RUN) . '.', array(
      $row,
      LINKCHECKER_SCAN_MAX_LINKS_PER_RUN,
      $node_types,
    ), '', TRUE);
  }
}