diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:26:04 +0100 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-27 12:26:04 +0100 |
commit | 02ae36eba33a5e0957defd4619d337bfdd0c178f (patch) | |
tree | d80f58cdf9eb774d00fc5fc322bf0750b644dab2 /db | |
parent | 89a1713f062cc78b727c6240a91408d91611dbab (diff) |
fixed mark all unread serverside (was missing highestitemid, dont use lastmodified to compare for new versions but use the highest item id. if items are updated and the guidHash and feedId are the same then it will be deleted and newly inserted to make the lastmodified feasable
Diffstat (limited to 'db')
-rw-r--r-- | db/itemmapper.php | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/db/itemmapper.php b/db/itemmapper.php index 0208472b3..f4702a626 100644 --- a/db/itemmapper.php +++ b/db/itemmapper.php @@ -92,14 +92,15 @@ class ItemMapper extends Mapper implements IMapper { } - public function readFeed($feedId, $userId){ + 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` = ? ' . - 'SET `items`.`status` = (`items`.`status` & ?) ' . - 'WHERE `items`.`id` = ?'; - $params = array(~StatusFlag::UNREAD, $userId, $feedId); + 'AND `feeds`.`id` = ? ' . + 'AND `items`.`id` <= ? ' . + 'SET `items`.`status` = (`items`.`status` & ?) '; + $params = array($userId, $feedId, $highestItemId, ~StatusFlag::UNREAD); $this->execute($sql, $params); } @@ -107,7 +108,7 @@ class ItemMapper extends Mapper implements IMapper { public function findAllNewFeed($id, $updatedSince, $status, $userId){ $sql = 'AND `items`.`feed_id` = ? ' . - 'AND `items`.`last_modified` >= ?'; + 'AND `items`.`id` >= ?'; $sql = $this->makeSelectQueryStatus($sql); $params = array($userId, $status, $id, $updatedSince); return $this->findAllRows($sql, $params); @@ -116,7 +117,7 @@ class ItemMapper extends Mapper implements IMapper { public function findAllNewFolder($id, $updatedSince, $status, $userId){ $sql = 'AND `feeds`.`folder_id` = ? ' . - 'AND `items`.`last_modified` >= ?'; + 'AND `items`.`id` >= ?'; $sql = $this->makeSelectQueryStatus($sql); $params = array($userId, $status, $id, $updatedSince); return $this->findAllRows($sql, $params); @@ -124,7 +125,7 @@ class ItemMapper extends Mapper implements IMapper { public function findAllNew($updatedSince, $status, $userId){ - $sql = $this->makeSelectQueryStatus('AND `items`.`last_modified` >= ?'); + $sql = $this->makeSelectQueryStatus('AND `items`.`id` >= ?'); $params = array($userId, $status, $updatedSince); return $this->findAllRows($sql, $params); } |