aboutsummaryrefslogtreecommitdiff
path: root/app/Models/EntryDAOSQLite.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-09-08 19:23:16 +0200
committerGravatar GitHub <noreply@github.com> 2018-09-08 19:23:16 +0200
commitb5dfb5538937e95a95e291cafe6234522d9c93d4 (patch)
treee26154c0cefaee6abe75ac4e5c72f387afcf4161 /app/Models/EntryDAOSQLite.php
parent1477a62b35bbd2351ed238cb80b681b6d6ba99d5 (diff)
Fix SQLite and PostgreSQL (#2007)
Regression from https://github.com/FreshRSS/FreshRSS/pull/1995
Diffstat (limited to 'app/Models/EntryDAOSQLite.php')
-rw-r--r--app/Models/EntryDAOSQLite.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/app/Models/EntryDAOSQLite.php b/app/Models/EntryDAOSQLite.php
index cca970e36..30d849cf4 100644
--- a/app/Models/EntryDAOSQLite.php
+++ b/app/Models/EntryDAOSQLite.php
@@ -159,19 +159,19 @@ DROP TABLE IF EXISTS `tmp`;
* @param integer $priorityMin
* @return integer affected rows
*/
- public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filters = null, $state = 0) {
+ public function markReadEntries($idMax = 0, $onlyFavorites = false, $priorityMin = 0, $filters = null, $state = 0, $is_read = true) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadEntries(0) is deprecated!');
}
- $sql = 'UPDATE `' . $this->prefix . 'entry` SET is_read=1 WHERE is_read=0 AND id <= ?';
+ $sql = 'UPDATE `' . $this->prefix . 'entry` SET is_read = ? WHERE is_read <> ? AND id <= ?';
if ($onlyFavorites) {
$sql .= ' AND is_favorite=1';
} elseif ($priorityMin >= 0) {
$sql .= ' AND id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.priority > ' . intval($priorityMin) . ')';
}
- $values = array($idMax);
+ $values = array($is_read ? 1 : 0, $is_read ? 1 : 0, $idMax);
list($searchValues, $search) = $this->sqlListEntriesWhere('', $filters, $state);
@@ -199,17 +199,17 @@ DROP TABLE IF EXISTS `tmp`;
* @param integer $idMax fail safe article ID
* @return integer affected rows
*/
- public function markReadCat($id, $idMax = 0, $filters = null, $state = 0) {
+ public function markReadCat($id, $idMax = 0, $filters = null, $state = 0, $is_read = true) {
if ($idMax == 0) {
$idMax = time() . '000000';
Minz_Log::debug('Calling markReadCat(0) is deprecated!');
}
$sql = 'UPDATE `' . $this->prefix . 'entry` '
- . 'SET is_read=1 '
- . 'WHERE is_read=0 AND id <= ? AND '
+ . 'SET is_read = ? '
+ . 'WHERE is_read <> ? AND id <= ? AND '
. 'id_feed IN (SELECT f.id FROM `' . $this->prefix . 'feed` f WHERE f.category=?)';
- $values = array($idMax, $id);
+ $values = array($is_read ? 1 : 0, $is_read ? 1 : 0, $idMax, $id);
list($searchValues, $search) = $this->sqlListEntriesWhere('', $filters, $state);