From 018273e2720c481c699ecc5cca1cdc90599921f7 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Tue, 3 Dec 2013 22:53:51 +0100 Subject: Corrige bug marquer tous les favoris comme lus Corrige https://github.com/marienfressinaud/FreshRSS/issues/270 --- app/models/Entry.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'app/models/Entry.php') diff --git a/app/models/Entry.php b/app/models/Entry.php index 899e98b00..6c37c3d6e 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -257,11 +257,14 @@ class EntryDAO extends Model_pdo { return false; } } - public function markReadEntries ($idMax = 0) { + public function markReadEntries ($idMax = 0, $onlyFavorites = false) { if ($idMax === 0) { $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' . 'WHERE e.is_read = 0 AND f.priority > 0'; + if ($onlyFavorites) { + $sql .= ' AND e.is_favorite = 1'; + } $stm = $this->bd->prepare ($sql); if ($stm && $stm->execute ()) { return $stm->rowCount(); @@ -276,6 +279,9 @@ class EntryDAO extends Model_pdo { $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' . 'SET e.is_read = 1 ' . 'WHERE e.is_read = 0 AND e.id <= ? AND f.priority > 0'; + if ($onlyFavorites) { + $sql .= ' AND e.is_favorite = 1'; + } $values = array ($idMax); $stm = $this->bd->prepare ($sql); if (!($stm && $stm->execute ($values))) { -- cgit v1.2.3