Commit d284ea04 authored by gbyte.co's avatar gbyte.co

Clearing sitemap cache now after sitemap generation and not right before.

parent dadcd579
......@@ -12,6 +12,7 @@ namespace Drupal\simple_sitemap;
use Drupal\user\Entity\User;
use Drupal\Core\Url;
use Drupal\Component\Utility\Html;
use Drupal\Core\Cache\Cache;
class Batch {
......@@ -101,6 +102,7 @@ class Batch {
if (!empty($results) || is_null(db_query('SELECT MAX(id) FROM {simple_sitemap}')->fetchField())) {
SitemapGenerator::generateSitemap($results['generate']);
}
Cache::invalidateTags(array('simple_sitemap'));
drupal_set_message(t("The <a href='@url' target='_blank'>XML sitemap</a> has been regenerated for all languages.",
array('@url' => $GLOBALS['base_url'] . '/sitemap.xml')));
}
......
......@@ -7,7 +7,6 @@
namespace Drupal\simple_sitemap;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Cache\Cache;
/**
* Simplesitemap class.
......@@ -96,7 +95,6 @@ class Simplesitemap {
* is to be run.
*/
public function generateSitemap($from = 'form') {
Cache::invalidateTags(array('simple_sitemap'));
db_truncate('simple_sitemap')->execute();
$generator = new SitemapGenerator($from);
$generator->setCustomLinks($this->getConfig('custom'));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment