]> git.wh0rd.org Git - tt-rss.git/commitdiff
remove PG_VERSION config variable, get version from server
authorAndrew Dolgov <fox@madoka.spb.ru>
Fri, 31 Mar 2006 04:19:45 +0000 (05:19 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Fri, 31 Mar 2006 04:19:45 +0000 (05:19 +0100)
config.php-dist
functions.php

index d07f2eb64eb737d3133086f92f5d3f72b5e46eab..fa7376af75c1a78d41332d54b6c883db610e55df 100644 (file)
@@ -9,9 +9,6 @@
        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 be95caa04b9f046f6dcdedc069644d89ed08e7ae..14d9fa1548517ce38105f0a676c5d5bf79e3efcb 100644 (file)
@@ -24,7 +24,9 @@
                                (SELECT date_entered FROM ttrss_entries WHERE
                                        id = ref_id) < NOW() - INTERVAL '$purge_interval days'"); */
 
-                       if (PG_VERSION == "7.4" || PG_VERSION == "8.0") {
+                       $pg_version = get_pgsql_version($link);
+
+                       if (preg_match("/^7\./", $pg_version) || preg_match("/^8\.0/", $pg_version)) {
 
                                $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE 
                                        ttrss_entries.id = ref_id AND 
                }
        }
 
+       function get_pgsql_version($link) {
+               $result = db_query($link, "SELECT version() AS version");
+               $version = split(" ", db_fetch_result($result, 0, "version"));
+               return $version[1];
+       }
+
 ?>