From 5db1cf21ec0a5007f28684942680b2a391853d62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Chans=C3=A9aume?= Date: Tue, 29 Apr 2014 17:23:08 +0200 Subject: [PATCH] ajout doc --- .../Front/Controller/SitemapController.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/local/modules/Front/Controller/SitemapController.php b/local/modules/Front/Controller/SitemapController.php index db40a387a..422d4247f 100644 --- a/local/modules/Front/Controller/SitemapController.php +++ b/local/modules/Front/Controller/SitemapController.php @@ -18,16 +18,17 @@ use Thelia\Core\HttpFoundation\Request; use Thelia\Core\HttpFoundation\Response; use Thelia\Log\Tlog; use Thelia\Model\ConfigQuery; -use Thelia\Model\LangQuery; -use Thelia\Model\Lang; - /** - * Class SitemapController + * Controller uses to generate sitemap.xml + * + * A default cache of 2 hours is used to avoid attack. You can flush cache if you have `ADMIN` role and pass flush=1 in + * query parameter. + * * @package Front\Controller * @author Julien Chanséaume */ -class SitemapController extends BaseFrontController { +class SitemapController extends BaseFrontController { /** @@ -46,10 +47,8 @@ class SitemapController extends BaseFrontController { public function generateAction() { - // check if already cached /** @var Request $request */ $request = $this->getRequest(); - $context = $request->query->get("context", ""); $flush = $request->query->get("flush", ""); $expire = ConfigQuery::read("sitemap_ttl", '7200'); @@ -58,7 +57,7 @@ class SitemapController extends BaseFrontController { $cacheFileURL = $cacheDir . self::SITEMAP_FILE . '.xml'; $expire = intval($expire) ?: 7200; $cacheContent = null; - + if (!($this->checkAdmin() && "" !== $flush)){ try { $cacheContent = $this->getCache($cacheFileURL, $expire); @@ -69,7 +68,6 @@ class SitemapController extends BaseFrontController { } if (null === $cacheContent){ - // render the view $cacheContent = $this->renderRaw("sitemap");