You are here

public function LinkExtractorBatch::batch in Link checker 8

Sets a batch to extract links from entities.

File

src/LinkExtractorBatch.php, line 182

Class

LinkExtractorBatch
Helper service to handle extraction index.

Namespace

Drupal\linkchecker

Code

public function batch() {

  // Clear index to reindex all entities.
  $this->database
    ->truncate('linkchecker_index')
    ->execute();
  $batch = new BatchBuilder();
  $batch
    ->setTitle('Extract entities')
    ->addOperation([
    $this,
    'batchProcessEntities',
  ], [
    20,
  ])
    ->setProgressive()
    ->setFinishCallback([
    $this,
    'batchFinished',
  ]);
  batch_set($batch
    ->toArray());
}