summaryrefslogtreecommitdiffstats
path: root/db/itemmapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'db/itemmapper.php')
-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);
+ }
+
+
}