]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix and enable purge_feed()
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 10:15:56 +0000 (11:15 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 19 Nov 2005 10:15:56 +0000 (11:15 +0100)
functions.php

index 36741a19996a8185331bbe7399b61566c2b85a1b..7e2eb90a2459dce950e4b5a978759d66733b764d 100644 (file)
@@ -8,16 +8,16 @@
 
        function purge_feed($link, $feed_id, $purge_interval) {
 
-               return; // FIXME disabled for now
-       
                if (DB_TYPE == "pgsql") {
-                       db_query($link, "DELETE FROM ttrss_entries WHERE
+                       db_query($link, "DELETE FROM ttrss_user_entries WHERE
                                marked = false AND feed_id = '$feed_id' AND
-                               date_entered < NOW() - INTERVAL '$purge_interval days'");
+                               (SELECT date_entered FROM ttrss_entries WHERE
+                                       id = ref_id) < NOW() - INTERVAL '$purge_interval days'");
                } else {
-                       db_query($link, "DELETE FROM ttrss_entries WHERE
+                       db_query($link, "DELETE FROM ttrss_user_entries WHERE
                                marked = false AND feed_id = '$feed_id' AND
-                               date_entered < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
+                               (SELECT date_entered FROM ttrss_entries WHERE 
+                                       id = ref_id) < DATE_SUB(NOW(), INTERVAL $purge_interval DAY)");
                }
        }