ImageListPager: Don't query by oi_user
authorBrad Jorsch <bjorsch@wikimedia.org>
Wed, 12 Dec 2018 15:31:40 +0000 (10:31 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Wed, 12 Dec 2018 15:31:40 +0000 (10:31 -0500)
For some reason we have indexes for `image` on `(img_user_text,img_timestamp)` and
`(img_user,img_timestamp)`, but for `oldimage` we only have
`(oi_user_text,oi_timestamp)`. Thus, when building the query in
ImageListPager, we have to be sure to avoid trying to use `oi_user`
rather than `oi_user_text` in the WHERE part.

Bug: T211774
Change-Id: Ibea058031f1cb3421e92e09f0a705ea00fb22008

includes/specials/pagers/ImageListPager.php

index ab3237a..ab38e1a 100644 (file)
@@ -139,7 +139,9 @@ class ImageListPager extends TablePager {
                        $actorWhere = ActorMigration::newMigration()->getWhere(
                                $dbr,
                                $prefix . '_user',
-                               User::newFromName( $this->mUserName, false )
+                               User::newFromName( $this->mUserName, false ),
+                               // oldimage doesn't have an index on oi_user, while image does. Set $useId accordingly.
+                               $prefix === 'img'
                        );
                        $conds[] = $actorWhere['conds'];
                }