summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorBernhard Posselt <nukeawhale@gmail.com>2013-04-12 11:54:49 +0200
committerBernhard Posselt <nukeawhale@gmail.com>2013-04-12 11:54:49 +0200
commit3baa8b51e42a1d353d5d9335a4c464d224027a40 (patch)
tree7e4ffdf3722b176836bbda84b046ab3d85e44b51 /db
parente8cdb315693dce4212597932ab99ccc23ec8ab0c (diff)
implement mark as read for feeds and folders, fix #29
Diffstat (limited to 'db')
-rw-r--r--db/itemmapper.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php
index 2ba0a7f2c..077614695 100644
--- a/db/itemmapper.php
+++ b/db/itemmapper.php
@@ -115,15 +115,16 @@ class ItemMapper extends Mapper implements IMapper {
public function readFeed($feedId, $highestItemId, $userId){
- $sql = 'UPDATE `*PREFIX*news_feeds` `feeds` ' .
- 'JOIN `*PREFIX*news_items` `items` ' .
- 'ON `items`.`feed_id` = `feeds`.`id` ' .
- 'AND `feeds`.`user_id` = ? ' .
- 'AND `feeds`.`id` = ? ' .
- 'AND `items`.`id` <= ? ' .
- 'SET `items`.`status` = (`items`.`status` & ?) ';
- $params = array($userId, $feedId, $highestItemId, ~StatusFlag::UNREAD);
-
+ $sql = 'UPDATE `*PREFIX*news_items` ' .
+ 'SET `status` = `status` & ? ' .
+ 'WHERE `feed_id` = ? ' .
+ 'AND `id` <= ? ' .
+ 'AND EXISTS (' .
+ 'SELECT * FROM `*PREFIX*news_feeds` ' .
+ 'WHERE `user_id` = ? ' .
+ 'AND `id` = ? ) ';
+ $params = array(~StatusFlag::UNREAD, $feedId, $highestItemId, $userId,
+ $feedId);
$this->execute($sql, $params);
}