From: Brion Vibber Date: Fri, 17 Dec 2010 23:25:19 +0000 (-0800) Subject: Update sorting on api/statuses/retweets_of_me; was and remains poorly indexed, but... X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=b80151275a8659e241b66e8f8454541d236f2f0e;p=quix0rs-gnu-social.git Update sorting on api/statuses/retweets_of_me; was and remains poorly indexed, but will use updated sorting method. --- diff --git a/classes/User.php b/classes/User.php index 1b1b971ec7..edbd6bb2e3 100644 --- a/classes/User.php +++ b/classes/User.php @@ -800,17 +800,17 @@ class User extends Memcached_DataObject 'FROM notice original JOIN notice rept ON original.id = rept.repeat_of ' . 'WHERE original.profile_id = ' . $this->id . ' '; - if ($since_id != 0) { - $qry .= 'AND original.id > ' . $since_id . ' '; + $since = Notice::whereSinceId($since_id, 'original.id', 'original.created'); + if ($since) { + $qry .= "AND ($since) "; } - if ($max_id != 0) { - $qry .= 'AND original.id <= ' . $max_id . ' '; + $max = Notice::whereMaxId($max_id, 'original.id', 'original.created'); + if ($max) { + $qry .= "AND ($max) "; } - // NOTE: we sort by fave time, not by notice time! - - $qry .= 'ORDER BY original.id DESC '; + $qry .= 'ORDER BY original.created, original.id DESC '; if (!is_null($offset)) { $qry .= "LIMIT $limit OFFSET $offset";