X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FActiveUsersPager.php;h=83fb8493ff6a7117df2e85d753c08a126bc28ea1;hp=0665e112ee7491c3a4a2c723a09be8d2f63b8e5f;hb=8caf853f22fe641bb9bdcf4214948d1268dbbb7d;hpb=237d3271fd313ebe09858a5c442a91216a7b61cf diff --git a/includes/specials/pagers/ActiveUsersPager.php b/includes/specials/pagers/ActiveUsersPager.php index 0665e112ee..83fb8493ff 100644 --- a/includes/specials/pagers/ActiveUsersPager.php +++ b/includes/specials/pagers/ActiveUsersPager.php @@ -79,14 +79,18 @@ class ActiveUsersPager extends UsersPager { function getQueryInfo() { $dbr = $this->getDatabase(); + $rcQuery = ActorMigration::newMigration()->getJoin( 'rc_user' ); + $activeUserSeconds = $this->getConfig()->get( 'ActiveUserDays' ) * 86400; $timestamp = $dbr->timestamp( wfTimestamp( TS_UNIX ) - $activeUserSeconds ); - $tables = [ 'querycachetwo', 'user', 'recentchanges' ]; + $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', - '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' ), @@ -97,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() ); } @@ -118,17 +122,17 @@ class ActiveUsersPager extends UsersPager { ) . ')'; } - if ( $dbr->implicitGroupby() ) { - $options = [ 'GROUP BY' => [ 'qcc_title' ] ]; - } else { - $options = [ 'GROUP BY' => [ 'user_name', 'user_id', 'qcc_title' ] ]; - } - return [ 'tables' => $tables, - 'fields' => [ 'user_name', 'user_id', 'recentedits' => 'COUNT(*)', 'qcc_title' ], - 'options' => $options, - 'conds' => $conds + 'fields' => [ + 'qcc_title', + 'user_name' => 'qcc_title', + 'user_id' => 'MAX(user_id)', + 'recentedits' => 'COUNT(*)' + ], + 'options' => [ 'GROUP BY' => [ 'qcc_title' ] ], + 'conds' => $conds, + 'join_conds' => $jconds, ]; }