aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-09-08 23:05:56 +0200
committerGravatar GitHub <noreply@github.com> 2018-09-08 23:05:56 +0200
commitc65f5358904c585ce144885be2fbcd960adaf1e6 (patch)
tree3c0feaecfd6668dabc4d7d2766d341c0fbd76091 /app
parentc24bf33e58acdcfb3b3b827a2f0609fa13747509 (diff)
Fix count unreads in SQLite (#2009)
* Fix count unreads in SQLite Was wrong in e.g. `./cli/user-info.php` because UNION output order in MySQL and SQLite is differents... * Changelog 2009
Diffstat (limited to 'app')
-rw-r--r--app/Models/EntryDAO.php2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php
index e17f6ff34..f0e164995 100644
--- a/app/Models/EntryDAO.php
+++ b/app/Models/EntryDAO.php
@@ -909,6 +909,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo implements FreshRSS_Searchable {
$stm = $this->bd->prepare($sql);
$stm->execute();
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
+ rsort($res);
$all = empty($res[0]) ? 0 : $res[0];
$unread = empty($res[1]) ? 0 : $res[1];
return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);
@@ -963,6 +964,7 @@ SQL;
$stm = $this->bd->prepare($sql);
$stm->execute(array(':priority_normal' => FreshRSS_Feed::PRIORITY_NORMAL));
$res = $stm->fetchAll(PDO::FETCH_COLUMN, 0);
+ rsort($res);
$all = empty($res[0]) ? 0 : $res[0];
$unread = empty($res[1]) ? 0 : $res[1];
return array('all' => $all, 'unread' => $unread, 'read' => $all - $unread);