From 1f2391b0cdf8e7a9f8d922c7c2f71acfc4bc6388 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Thu, 4 Apr 2013 13:23:03 +0200 Subject: move autopurge to itembl --- db/itemmapper.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'db/itemmapper.php') 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); + } + + } -- cgit v1.2.3