]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
add last-modified header to sitemaps to keep them from getting regenerated
authorEvan Prodromou <evan@status.net>
Wed, 11 Aug 2010 06:35:47 +0000 (23:35 -0700)
committerEvan Prodromou <evan@status.net>
Wed, 11 Aug 2010 06:35:47 +0000 (23:35 -0700)
plugins/Sitemap/sitemapaction.php

index 45edfccc51a05b6a4c8f70029a83e5a79f2adfbc..73b9248a3859cc23c02fa7aee7906917d0f2d590 100644 (file)
@@ -53,6 +53,8 @@ class SitemapAction extends Action
 
     function handle($args)
     {
+        parent::handle($args);
+
         header('Content-Type: text/xml; charset=UTF-8');
         $this->startXML();
 
@@ -67,6 +69,27 @@ class SitemapAction extends Action
         $this->endXML();
     }
 
+    function lastModified()
+    {
+        $y = $this->trimmed('year');
+
+        $m = $this->trimmed('month');
+        $d = $this->trimmed('day');
+
+        $y += 0;
+        $m += 0;
+        $d += 0;
+
+        $begdate = strtotime("$y-$m-$d 00:00:00");
+        $enddate = $begdate + (24 * 60 * 60);
+
+        if ($enddate < time()) {
+            return $enddate;
+        } else {
+            return null;
+        }
+    }
+
     function showUrl($url, $lastMod=null, $changeFreq=null, $priority=null)
     {
         $this->elementStart('url');