You are here

public function LinkCheckerBatch::batchProcessQueue in Link checker 8

Process linkchecker_check queue.

Parameters

mixed $context: Context data from batch API.

File

src/LinkCheckerBatch.php, line 125

Class

LinkCheckerBatch
Helper service to handle links checking.

Namespace

Drupal\linkchecker

Code

public function batchProcessQueue(&$context) {
  if (!isset($context['sandbox']['total'])) {
    $context['sandbox']['total'] = $this
      ->getTotalLinksToProcess();
    $context['sandbox']['current'] = 0;
  }
  $this
    ->processQueueItem();
  $context['sandbox']['current']++;
  if (!empty($context['sandbox']['total'])) {
    $context['finished'] = $context['sandbox']['current'] / $context['sandbox']['total'];
  }
  else {
    $context['finished'] = 1;
  }
}