]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
handle if-modified-since in RSS feeds
authorEvan Prodromou <evan@controlyourself.ca>
Fri, 20 Feb 2009 14:58:38 +0000 (14:58 +0000)
committerEvan Prodromou <evan@controlyourself.ca>
Fri, 20 Feb 2009 14:58:38 +0000 (14:58 +0000)
lib/rssaction.php

index 131e8ac65acf86424b0b251b67527441f9b41966..66c2d9e8cd2399adf22a6311a044ae604fadf458 100644 (file)
@@ -38,6 +38,7 @@ class Rss10Action extends Action
 
     var $creators = array();
     var $limit = DEFAULT_RSS_LIMIT;
+    var $notices = null;
 
     /**
      * Constructor
@@ -93,6 +94,9 @@ class Rss10Action extends Action
 
     function handle($args)
     {
+        // Get the list of notices
+        $this->notices = $this->getNotices();
+        // Parent handling, including cache check
         parent::handle($args);
         $this->showRss($this->limit);
     }
@@ -258,5 +262,25 @@ class Rss10Action extends Action
     {
         $this->elementEnd('rdf:RDF');
     }
+
+    /**
+     * When was this page last modified?
+     *
+     */
+
+    function lastModified()
+    {
+        if (empty($this->notices)) {
+            return null;
+        }
+
+        if (count($this->notices) == 0) {
+            return null;
+        }
+
+        // FIXME: doesn't handle modified profiles, avatars, deleted notices
+
+        return strtotime($this->notices[0]->created);
+    }
 }