diff options
-rw-r--r-- | db/feedmapper.php | 6 | ||||
-rw-r--r-- | tests/db/FeedMapperTest.php | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/db/feedmapper.php b/db/feedmapper.php index ba47d0a8a..108494613 100644 --- a/db/feedmapper.php +++ b/db/feedmapper.php @@ -135,8 +135,10 @@ class FeedMapper extends Mapper implements IMapper { public function deleteReadOlderThanId($id){ - $sql = 'DELETE FROM `*PREFIX*news_items` WHERE `id` < ?'; - $params = array($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); } diff --git a/tests/db/FeedMapperTest.php b/tests/db/FeedMapperTest.php index de414d9c8..58a683836 100644 --- a/tests/db/FeedMapperTest.php +++ b/tests/db/FeedMapperTest.php @@ -268,8 +268,10 @@ class FeedMapperTest extends \OCA\AppFramework\Utility\MapperTestUtility { public function testDeleteReadOlderThanId(){ $id = 10; - $sql = 'DELETE FROM `*PREFIX*news_items` WHERE `id` < ?'; - $params = array($id); + $status = StatusFlag::STARRED | StatusFlag::UNREAD; + $sql = 'DELETE FROM `*PREFIX*news_items` WHERE `id` < ? ' . + 'AND NOT ((`status` & ?) > 0)'; + $params = array($id, $status); $this->setMapperResult($sql, $params); $this->mapper->deleteReadOlderThanId($id); |