summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2005-10-11 14:21:27 +0100
committerAndrew Dolgov <[email protected]>2005-10-11 14:21:27 +0100
commit3b063a95c5725fdab3c3c4efe6d6f54cd9aa7697 (patch)
tree8f434d217f30a792e45bc4d155e8482d4d2ea48c
parente1305a97d0d99aaa3def982011cfae73701aa3b1 (diff)
fix auto expiration bug on MySQL backend
-rw-r--r--functions.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/functions.php b/functions.php
index 962b03e8f..80cd61913 100644
--- a/functions.php
+++ b/functions.php
@@ -5,9 +5,16 @@
function purge_old_posts($link) {
if (PURGE_OLD_DAYS > 0) {
- $result = db_query($link, "DELETE FROM ttrss_entries WHERE
- marked = false AND
- date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
+
+ if (DB_TYPE == "pgsql") {
+ $result = db_query($link, "DELETE FROM ttrss_entries WHERE
+ marked = false AND
+ date_entered < NOW() - INTERVAL '".PURGE_OLD_DAYS." days'");
+ } else {
+ $result = db_query($link, "DELETE FROM ttrss_entries WHERE
+ marked = false AND
+ date_entered < DATE_SUB(NOW(), INTERVAL ".PURGE_OLD_DAYS." DAY)");
+ }
}
}
@@ -205,7 +212,8 @@
content_hash,
feed_id,
comments,
- no_orig_date)
+ no_orig_date,
+ date_entered)
VALUES
('$entry_title',
'$entry_guid',
@@ -215,7 +223,8 @@
'$content_hash',
'$feed',
'$entry_comments',
- $no_orig_date)";
+ $no_orig_date,
+ NOW())";
$result = db_query($link, $query);