]> git.wh0rd.org - tt-rss.git/commitdiff
filter_to_sql: limit results to last 30 days of articles
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Apr 2011 16:01:25 +0000 (20:01 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Mon, 18 Apr 2011 16:01:25 +0000 (20:01 +0400)
functions.php

index 3d4a9849d26f60e5f801ae3faf991b56be8eade1..a3e3e8f9746025eab90c2604dcd2e3db83f157a2 100644 (file)
                if ($filter["inverse"])
                        $query = "NOT ($query)";
 
-               if ($query)
+               if ($query) {
+                       if (DB_TYPE == "pgsql") {
+                               $query .= " AND ttrss_entries.date_entered > NOW() - INTERVAL '30 days'";
+                       } else {
+                               $query .= " AND ttrss_entries.date_entered > DATE_SUB(NOW(), INTERVAL 30 DAY";
+                       }
                        $query .= " AND ";
+               }
 
                return $query;
        }