public static function BatchTrait::doBatchGenerateSitemap in Simple XML sitemap 4.x
Same name and namespace in other branches
- 8.3 src/Queue/BatchTrait.php \Drupal\simple_sitemap\Queue\BatchTrait::doBatchGenerateSitemap()
@todo Variants into generateSitemap().
Parameters
$context:
Throws
\Drupal\Component\Plugin\Exception\PluginException
1 call to BatchTrait::doBatchGenerateSitemap()
- Tester::doBatchGenerateSitemap in tests/
scripts/ performance_test.php
File
- src/
Queue/ BatchTrait.php, line 61
Class
Namespace
Drupal\simple_sitemap\QueueCode
public static function doBatchGenerateSitemap(&$context) : void {
/** @var \Drupal\simple_sitemap\Queue\QueueWorker $queue_worker */
$queue_worker = \Drupal::service('simple_sitemap.queue_worker');
$queue_worker
->generateSitemap();
$processed_element_count = $queue_worker
->getProcessedElementCount();
$original_element_count = $queue_worker
->getInitialElementCount();
$context['message'] = t('@indexed out of @total total queue items have been processed.', [
'@indexed' => $processed_element_count,
'@total' => $original_element_count,
]);
$context['finished'] = $original_element_count > 0 ? $processed_element_count / $original_element_count : 1;
}