/** * @param ModelSaveEvent $event */ public function generateSeoSitemap(ModelSaveEvent $event) { if ($this->canGenerateSitemapAutomatically() && $this->isAllowedModule($event->getModuleName())) { try { $this->sitemapGenerationModel->save(); } catch (SitemapGenerationException $e) { $this->logger->info('seo-sitemap', $e->getMessage()); } } }
/** * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse */ public function execute() { $result = false; $phrase = 'sitemap_error'; if ($this->config->getSettings(Schema::MODULE_NAME)['sitemap_is_enabled'] == 1) { $result = $this->sitemapGenerationModel->save(); $phrase = $result === true ? 'sitemap_success' : 'sitemap_error'; } return $this->redirectMessages()->setMessage($result, $this->translator->t('seo', $phrase)); }