You are here

function _linkchecker_batch_import_nodes in Link checker 5.2

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

Batch: Load all nodes 100 by hundred.

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

File

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

Code

function _linkchecker_batch_import_nodes($node_types = array()) {

  // Node import count.
  $placeholders = implode(',', array_fill(0, count($node_types), "'%s'"));
  $rows = db_result(db_query('SELECT COUNT(DISTINCT nid) FROM {node} WHERE status = %d AND type IN (' . $placeholders . ')', array_merge(array(
    1,
  ), $node_types)));
  for ($row = 0; $row < $rows; $row = $row + LINKCHECKER_SCAN_MAX_LINKS_PER_RUN) {
    job_queue_add('_linkchecker_batch_node_import_op', 'Scan nodes from row ' . $row . ' to ' . ($row + LINKCHECKER_SCAN_MAX_LINKS_PER_RUN) . '.', array(
      $row,
      LINKCHECKER_SCAN_MAX_LINKS_PER_RUN,
      $node_types,
    ), '', TRUE);
  }
}