summaryrefslogtreecommitdiffstats
path: root/db/feedmapper.php
diff options
context:
space:
mode:
Diffstat (limited to 'db/feedmapper.php')
-rw-r--r--db/feedmapper.php24
1 files changed, 22 insertions, 2 deletions
diff --git a/db/feedmapper.php b/db/feedmapper.php
index d84cebad1..ba47d0a8a 100644
--- a/db/feedmapper.php
+++ b/db/feedmapper.php
@@ -57,8 +57,8 @@ class FeedMapper extends Mapper implements IMapper {
}
- private function findAllRows($sql, $params=array()){
- $result = $this->execute($sql, $params);
+ private function findAllRows($sql, $params=array(), $limit=null){
+ $result = $this->execute($sql, $params, $limit);
$feeds = array();
while($row = $result->fetchRow()){
@@ -121,4 +121,24 @@ class FeedMapper extends Mapper implements IMapper {
$this->execute($sql, $params);
}
+
+ 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){
+ $sql = 'DELETE FROM `*PREFIX*news_items` WHERE `id` < ?';
+ $params = array($id);
+ $this->execute($sql, $params);
+ }
+
+
} \ No newline at end of file