From 1e59ae3582c48fd7a5e3b4853992afa1712da3a7 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 29 Mar 2006 04:43:21 +0100 Subject: [PATCH] fix purge_feed for pg 8.1, new option: PG_VERSION --- config.php-dist | 3 +++ functions.php | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/config.php-dist b/config.php-dist index fa7376af..d07f2eb6 100644 --- a/config.php-dist +++ b/config.php-dist @@ -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 diff --git a/functions.php b/functions.php index dc894568..8175a432 100644 --- a/functions.php +++ b/functions.php @@ -24,15 +24,28 @@ (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 -- 2.39.5