public function onSitemapGeneration() { // Is strategy live?
if ($this->config->
get('sitemapRefreshStrategy'
) !== SitemapExporterInterface::STRATEGY_CRON
) { return 'Sitemap Generation throught cronjob is disabled';
} $output = '';
/** @var Shop $shop */
foreach ($this->modelManager->
getRepository(Shop::
class)->
getActiveShopsFixed() as $shop) { $output .=
sprintf('Generating sitemaps for shop #%d (%s)...',
$shop->
getId(),
$shop->
getName()) . PHP_EOL;
try { $this->sitemapExporter->
generate($shop);
} catch (AlreadyLockedException
$exception) { $output .=
sprintf('ERROR: %s',
$exception->
getMessage()) . PHP_EOL;
} } return $output;
}}