diff --git a/xmlsitemap.module b/xmlsitemap.module index ce969c2..5d5f36d 100644 --- a/xmlsitemap.module +++ b/xmlsitemap.module @@ -1420,6 +1420,14 @@ function xmlsitemap_run_unprogressive_batch() { if (PHP_SAPI === 'cli' && function_exists('drush_backend_batch_process')) { drush_backend_batch_process(); } + elseif (PHP_SAPI === 'cli') { + // batch_process() unconditionally calls Url::fromRouteMatch() which + // requires a current route — unavailable in CLI/cron context. Since + // progressive is already FALSE, call _batch_process() directly. + // See https://www.drupal.org/project/xmlsitemap/issues/3100808 + require_once DRUPAL_ROOT . '/core/includes/batch.inc'; + _batch_process(); + } else { batch_process(); }