summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-12-17 15:25:19 -0800
committerBrion Vibber <brion@pobox.com>2010-12-17 15:25:19 -0800
commitb80151275a8659e241b66e8f8454541d236f2f0e (patch)
tree80b7db18664663d0859d2a21c9462e0240a1c885
parent1b90ed564a19dcb3d24d0c0620ce0623773fe4d0 (diff)
Update sorting on api/statuses/retweets_of_me; was and remains poorly indexed, but will use updated sorting method.
-rw-r--r--classes/User.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/classes/User.php b/classes/User.php
index 1b1b971ec..edbd6bb2e 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";