You are here

function _linkchecker_batch_import_comments in Link checker 7

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

Batch: Scan comments for links.

3 calls to _linkchecker_batch_import_comments()
linkchecker_analyze_links_submit in ./linkchecker.admin.inc
Submit callback.
linkchecker_clear_analyze_links_submit in ./linkchecker.admin.inc
Submit callback.
linkchecker_node_type_form_submit in ./linkchecker.module
Submit handler for linkchecker_form_node_type_form_alter().

File

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

Code

function _linkchecker_batch_import_comments($node_types = array()) {

  // Get all active {comment}.cid's.
  $result = db_query('SELECT c.cid FROM {comment} c INNER JOIN {node} n ON c.nid = n.nid WHERE c.status = :cstatus AND n.status = :nstatus AND n.type IN (:types) ORDER BY c.cid', array(
    ':cstatus' => COMMENT_PUBLISHED,
    ':nstatus' => 1,
    ':types' => $node_types,
  ));
  $operations = array();
  foreach ($result as $row) {
    $operations[] = array(
      '_linkchecker_batch_comments_import_op',
      array(
        $row->cid,
      ),
    );
  }
  $batch = array(
    'file' => drupal_get_path('module', 'linkchecker') . '/linkchecker.batch.inc',
    'finished' => '_linkchecker_batch_comments_import_finished',
    'operations' => $operations,
    'title' => t('Scanning for links'),
  );
  return $batch;
}