]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix auto expiration bug on MySQL backend
authorAndrew Dolgov <fox@bah.spb.su>
Tue, 11 Oct 2005 13:21:27 +0000 (14:21 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Tue, 11 Oct 2005 13:21:27 +0000 (14:21 +0100)
functions.php

index 962b03e8fffa2588c2289d4abd093c96f0b3ef28..80cd61913343d85cc515cf8e2f7d30b0d30f9a16 100644 (file)
@@ -5,9 +5,16 @@
 
        function purge_old_posts($link) {
                if (PURGE_OLD_DAYS > 0) {
-                       $result = db_query($link, "DELETE FROM ttrss_entries WHERE
-                               marked = false AND 
-                               date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
+
+                       if (DB_TYPE == "pgsql") {
+                               $result = db_query($link, "DELETE FROM ttrss_entries WHERE
+                                       marked = false AND 
+                                       date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
+                       } else {
+                               $result = db_query($link, "DELETE FROM ttrss_entries WHERE
+                                       marked = false AND 
+                                       date_entered < DATE_SUB(NOW(), INTERVAL ".PURGE_OLD_DAYS." DAY)");
+                       }
                }
        }
 
                                                        content_hash,
                                                        feed_id, 
                                                        comments,                                                       
-                                                       no_orig_date) 
+                                                       no_orig_date,
+                                                       date_entered) 
                                                VALUES
                                                        ('$entry_title', 
                                                        '$entry_guid', 
                                                        '$content_hash',
                                                        '$feed', 
                                                        '$entry_comments',
-                                                       $no_orig_date)";
+                                                       $no_orig_date,
+                                                       NOW())";
 
                                        $result = db_query($link, $query);