From 8caf853f22fe641bb9bdcf4214948d1268dbbb7d Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Fri, 21 Sep 2018 14:32:34 -0400 Subject: [PATCH] Add join conditions to ActiveUsersPager We're (very slowly and somewhat unofficially) moving towards using join conditions everywhere, and here they're needed to avoid errors once the actor migration reaches the READ_NEW stage. Bug: T204767 Change-Id: I8bfe861fac7874f8938bed9bfac3b7ec6f478238 (cherry picked from commit 15441cabe60d84e17ffb25824aeb095d92bc375a) --- RELEASE-NOTES-1.31 | 1 + includes/specials/pagers/ActiveUsersPager.php | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/RELEASE-NOTES-1.31 b/RELEASE-NOTES-1.31 index a123ae8b3f..c5a2a9775b 100644 --- a/RELEASE-NOTES-1.31 +++ b/RELEASE-NOTES-1.31 @@ -47,6 +47,7 @@ THIS IS NOT A RELEASE YET * (T210998) Properly set $wgLanguageCode in the generated LocalSettings.php if --lang is used with the command-line installer (install.php). * Fix addition of ug_expiry column to user_groups table on MSSQL. +* (T204767) Add join conditions to ActiveUsersPager == MediaWiki 1.31.1 == diff --git a/includes/specials/pagers/ActiveUsersPager.php b/includes/specials/pagers/ActiveUsersPager.php index 26ed4997ee..83fb8493ff 100644 --- a/includes/specials/pagers/ActiveUsersPager.php +++ b/includes/specials/pagers/ActiveUsersPager.php @@ -83,13 +83,14 @@ class ActiveUsersPager extends UsersPager { $activeUserSeconds = $this->getConfig()->get( 'ActiveUserDays' ) * 86400; $timestamp = $dbr->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds ); - $tables = [ 'querycachetwo', 'user', 'recentchanges' ] + $rcQuery['tables']; - $jconds = $rcQuery['joins']; + $tables = [ 'querycachetwo', 'user', 'rc' => [ 'recentchanges' ] + $rcQuery['tables'] ]; + $jconds = [ + 'user' => [ 'JOIN', 'user_name = qcc_title' ], + 'rc' => [ 'JOIN', $rcQuery['fields']['rc_user_text'] . ' = qcc_title' ], + ] + $rcQuery['joins']; $conds = [ 'qcc_type' => 'activeusers', 'qcc_namespace' => NS_USER, - 'user_name = qcc_title', - $rcQuery['fields']['rc_user_text'] . ' = qcc_title', 'rc_type != ' . $dbr->addQuotes( RC_EXTERNAL ), // Don't count wikidata. 'rc_type != ' . $dbr->addQuotes( RC_CATEGORIZE ), // Don't count categorization changes. 'rc_log_type IS NULL OR rc_log_type != ' . $dbr->addQuotes( 'newusers' ), @@ -100,7 +101,7 @@ class ActiveUsersPager extends UsersPager { } if ( $this->groups !== [] ) { $tables[] = 'user_groups'; - $conds[] = 'ug_user = user_id'; + $jconds['user_groups'] = [ 'JOIN', [ 'ug_user = user_id' ] ]; $conds['ug_group'] = $this->groups; $conds[] = 'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() ); } -- 2.20.1