summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-04 13:23:03 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-04 13:23:03 +0200
commit1f2391b0cdf8e7a9f8d922c7c2f71acfc4bc6388 (patch)
tree6d4976b4bc1e0d3b5ecf6c4764ecf5a98bf7559c /db
parent3ec631a5c799e35ff5dbe519a3151ad62ad186b8 (diff)
move autopurge to itembl
Diffstat (limited to 'db')
-rw-r--r--db/itemmapper.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php
index f4702a626..a5c0e8af2 100644
--- a/db/itemmapper.php
+++ b/db/itemmapper.php
@@ -183,4 +183,25 @@ class ItemMapper extends Mapper implements IMapper {
}
+ public function getReadOlderThanThreshold($threshold){
+
+ // we want items that are not starred and not unread
+ $status = StatusFlag::STARRED | StatusFlag::UNREAD;
+ $sql = 'SELECT * FROM `*PREFIX*news_items` ' .
+ 'WHERE NOT ((`status` & ?) > 0)';
+
+ $params = array($status);
+ return $this->findAllRows($sql, $params, $threshold);
+ }
+
+
+ public function deleteReadOlderThanId($id){
+ $status = StatusFlag::STARRED | StatusFlag::UNREAD;
+ $sql = 'DELETE FROM `*PREFIX*news_items` WHERE `id` < ? ' .
+ 'AND NOT ((`status` & ?) > 0)';
+ $params = array($id, $status);
+ $this->execute($sql, $params);
+ }
+
+
}