fix purge_feed for pg 8.1, new option: PG_VERSION
This commit is contained in:
parent
1b2e1b0e52
commit
1e59ae3582
2 changed files with 21 additions and 5 deletions
|
@ -9,6 +9,9 @@
|
||||||
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
|
||||||
|
|
||||||
|
|
|
@ -24,15 +24,28 @@
|
||||||
(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'"); */
|
||||||
|
|
||||||
$result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
|
if (PG_VERSION == "7.4" || PG_VERSION == "8.0") {
|
||||||
ttrss_entries.id = ref_id AND
|
|
||||||
marked = false AND
|
$result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
|
||||||
feed_id = '$feed_id' AND
|
ttrss_entries.id = ref_id AND
|
||||||
ttrss_entries.date_entered < NOW() - INTERVAL '$purge_interval days'");
|
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);
|
$rows = pg_affected_rows($result);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
|
/* $result = db_query($link, "DELETE FROM ttrss_user_entries WHERE
|
||||||
marked = false AND feed_id = '$feed_id' AND
|
marked = false AND feed_id = '$feed_id' AND
|
||||||
(SELECT date_entered FROM ttrss_entries WHERE
|
(SELECT date_entered FROM ttrss_entries WHERE
|
||||||
|
|
Loading…
Reference in a new issue