From a0bf7c16bdfc057a521d0244ca0d60f3ebfd4235 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 27 Nov 2017 14:11:35 -0500 Subject: [PATCH] Fix sorting Also avoid sorting when it's not needed by queries --- lib/Database.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Database.php b/lib/Database.php index 07fbc397..577d3b39 100644 --- a/lib/Database.php +++ b/lib/Database.php @@ -841,7 +841,6 @@ class Database { subscribed_feeds.sub as subscription FROM arsse_articles" ); - $q->setOrder("edition".($context->reverse ? " desc" : "")); $q->setLimit($context->limit, $context->offset); $q->setCTE("user(user)", "SELECT ?", "str", $user); if ($context->subscription()) { @@ -1028,6 +1027,7 @@ class Database { throw new Exception("constantUnknown", $fields); } $q = $this->articleQuery($user, $context, $columns); + $q->setOrder("edited_date".($context->reverse ? " desc" : "")); $q->setJoin("left join arsse_enclosures on arsse_enclosures.article is arsse_articles.id"); // perform the query and return results return $this->db->prepare($q->getQuery(), $q->getTypes())->run($q->getValues());