public function Generator::generateSitemap in Simple XML sitemap 4.x
Generates all sitemaps.
Parameters
string $from: Can be 'form', 'drush', 'cron' and 'backend'.
Return value
$this
Throws
\Drupal\Component\Plugin\Exception\PluginException
File
- src/
Manager/ Generator.php, line 127
Class
- Generator
- Main managing service.
Namespace
Drupal\simple_sitemap\ManagerCode
public function generateSitemap(string $from = QueueWorker::GENERATE_TYPE_FORM) : Generator {
if (!$this->lock
->lockMayBeAvailable(QueueWorker::LOCK_ID)) {
$this->logger
->m('Unable to acquire a lock for sitemap generation.')
->log('error')
->display('error');
return $this;
}
switch ($from) {
case QueueWorker::GENERATE_TYPE_FORM:
case QueueWorker::GENERATE_TYPE_DRUSH:
$this->queueWorker
->batchGenerateSitemap($from);
break;
case QueueWorker::GENERATE_TYPE_CRON:
case QueueWorker::GENERATE_TYPE_BACKEND:
$this->queueWorker
->generateSitemap($from);
break;
}
return $this;
}