/** * Create new option / Update option value * * @param array $data Option data in the following format * * @return void */ public function createOption($data) { parent::createOption($data); if ('CDev\\XMLSitemap' == $data['category']) { \XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->clear(); } }
/** * Clear sitemaps * * @return void * * @PrePersist * @PreUpdate * @PreRemove */ public function clearSitemaps() { \XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->clear(); }
public function testgenerate() { foreach (glob(LC_DIR_DATA . 'xmlsitemap.*') as $path) { unlink($path); } $this->assertFalse(\XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->isGenerated(), '#1'); \XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->generate(); $this->assertTrue(\XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->isGenerated(), '#2'); $list = \XLite\Core\Database::getRepo('XLite\\Model\\Product')->findFrame(0, 1); $product = $list[0]; $product->setPrice(10); \XLite\Core\Database::getEM()->flush(); $this->assertFalse(\XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->isGenerated(), '#3'); }
/** * Check if current page is accessible * * @return boolean */ protected function checkAccess() { return parent::checkAccess() && !\XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance()->isEmpty(); }
/** * Run step * * @return void */ protected function runStep() { $generator = \XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance(); $generator->generate(); }
/** * Manually generate sitemap.xml * * @return void */ protected function doActionGenerate() { $generator = \XLite\Module\CDev\XMLSitemap\Logic\SitemapGenerator::getInstance(); $generator->generate(); \XLite\Core\TopMessage::addInfo('XML-Sitemap generated'); }