]> git.wh0rd.org Git - tt-rss.git/commitdiff
fix purge_feed for pg 8.1, new option: PG_VERSION
authorAndrew Dolgov <fox@madoka.spb.ru>
Wed, 29 Mar 2006 03:43:21 +0000 (04:43 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Wed, 29 Mar 2006 03:43:21 +0000 (04:43 +0100)
config.php-dist
functions.php

index fa7376af75c1a78d41332d54b6c883db610e55df..d07f2eb64eb737d3133086f92f5d3f72b5e46eab 100644 (file)
@@ -9,6 +9,9 @@
        define('DB_PASS', "XXXXXX");
        //define('DB_PORT', '5432'); // when neeeded, PG-only
 
+       define('PG_VERSION', '8.0');
+       // Your PostgreSQL server version. Valid values: 7.4, 8.0, 8.1
+       
        define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
        // Local cache directory for RSS feeds
        
index dc894568f341076cfd1a5d709b1d421c332b6aa3..8175a43261a2d50dfc891abff8bde8757e7e6b72 100644 (file)
                                (SELECT date_entered FROM ttrss_entries WHERE
                                        id = ref_id) < NOW() - INTERVAL '$purge_interval days'"); */
 
-                       $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE 
-                               ttrss_entries.id = ref_id AND 
-                               marked = false AND 
-                               feed_id = '$feed_id' AND 
-                               ttrss_entries.date_entered < NOW() - INTERVAL '$purge_interval days'");
+                       if (PG_VERSION == "7.4" || PG_VERSION == "8.0") {
+
+                               $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE 
+                                       ttrss_entries.id = ref_id AND 
+                                       marked = false AND 
+                                       feed_id = '$feed_id' AND 
+                                       ttrss_entries.date_entered < NOW() - INTERVAL '$purge_interval days'");
+
+                       } else {
+
+                               $result = db_query($link, "DELETE FROM ttrss_user_entries 
+                                       USING ttrss_entries 
+                                       WHERE ttrss_entries.id = ref_id AND 
+                                       marked = false AND 
+                                       feed_id = '$feed_id' AND 
+                                       ttrss_entries.date_entered < NOW() - INTERVAL '$purge_interval days')");
+                       }
 
                        $rows = pg_affected_rows($result);
                        
                } else {
+               
 /*                     $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
                                marked = false AND feed_id = '$feed_id' AND
                                (SELECT date_entered FROM ttrss_entries WHERE