]> git.immae.eu Git - github/shaarli/Shaarli.git/blobdiff - application/front/controller/visitor/DailyController.php
Daily RSS Cache: invalidate cache base on the date
[github/shaarli/Shaarli.git] / application / front / controller / visitor / DailyController.php
index 728bc2d8e81e4107d32efed827351255dea06b58..29492a5f3c1f3acd50d65547d9d3543dbf7e7a8a 100644 (file)
@@ -86,9 +86,11 @@ class DailyController extends ShaarliVisitorController
     public function rss(Request $request, Response $response): Response
     {
         $response = $response->withHeader('Content-Type', 'application/rss+xml; charset=utf-8');
+        $type = DailyPageHelper::extractRequestedType($request);
+        $cacheDuration = DailyPageHelper::getCacheDatePeriodByType($type);
 
         $pageUrl = page_url($this->container->environment);
-        $cache = $this->container->pageCacheManager->getCachePage($pageUrl);
+        $cache = $this->container->pageCacheManager->getCachePage($pageUrl, $cacheDuration);
 
         $cached = $cache->cachedVersion();
         if (!empty($cached)) {
@@ -96,7 +98,6 @@ class DailyController extends ShaarliVisitorController
         }
 
         $days = [];
-        $type = DailyPageHelper::extractRequestedType($request);
         $format = DailyPageHelper::getFormatByType($type);
         $length = DailyPageHelper::getRssLengthByType($type);
         foreach ($this->container->bookmarkService->search() as $bookmark) {
@@ -131,8 +132,8 @@ class DailyController extends ShaarliVisitorController
             $dataPerDay[$day] = [
                 'date' => $endDateTime,
                 'date_rss' => $endDateTime->format(DateTime::RSS),
-                'date_human' => DailyPageHelper::getDescriptionByType($type, $dayDateTime),
-                'absolute_url' => $indexUrl . 'daily?'. $type .'=' . $day,
+                'date_human' => DailyPageHelper::getDescriptionByType($type, $dayDateTime, false),
+                'absolute_url' => $indexUrl . 'daily?' . $type . '=' . $day,
                 'links' => [],
             ];