remove PG_VERSION config variable, get version from server

This commit is contained in:
Andrew Dolgov 2006-03-31 05:19:45 +01:00
parent 1b758780aa
commit 6e7f8d269e
2 changed files with 9 additions and 4 deletions

View File

@ -9,9 +9,6 @@
define('DB_PASS', "XXXXXX"); define('DB_PASS', "XXXXXX");
//define('DB_PORT', '5432'); // when neeeded, PG-only //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'); define('MAGPIE_CACHE_DIR', '/var/tmp/magpie-ttrss-cache');
// Local cache directory for RSS feeds // Local cache directory for RSS feeds

View File

@ -24,7 +24,9 @@
(SELECT date_entered FROM ttrss_entries WHERE (SELECT date_entered FROM ttrss_entries WHERE
id = ref_id) < NOW() - INTERVAL '$purge_interval days'"); */ 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 $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
ttrss_entries.id = ref_id AND ttrss_entries.id = ref_id AND
@ -1490,4 +1492,10 @@
} }
} }
function get_pgsql_version($link) {
$result = db_query($link, "SELECT version() AS version");
$version = split(" ", db_fetch_result($result, 0, "version"));
return $version[1];
}
?> ?>