X-Git-Url: https://git.heureux-cyclage.org/index.php?a=blobdiff_plain;f=includes%2Fspecials%2Fpagers%2FContribsPager.php;h=cd0499551dd51e6e79cf4082cbafc835591e0b05;hb=218e8311d578edfa04493cfde54f1850cd4cd6e3;hp=85faddc2e3e743e4127c90c9b0866b4824a2b933;hpb=fbb86f07d222ba6c31386472c5b792348b1c89e2;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/pagers/ContribsPager.php b/includes/specials/pagers/ContribsPager.php index 85faddc2e3..cd0499551d 100644 --- a/includes/specials/pagers/ContribsPager.php +++ b/includes/specials/pagers/ContribsPager.php @@ -185,8 +185,8 @@ class ContribsPager extends RangeChronologicalPager { ]; if ( $this->contribs == 'newbie' ) { - $max = $this->mDb->selectField( 'user', 'max(user_id)', false, __METHOD__ ); - $queryInfo['conds'][] = 'rev_user >' . (int)( $max - $max / 100 ); + $max = $this->mDb->selectField( 'user', 'max(user_id)', '', __METHOD__ ); + $queryInfo['conds'][] = $revQuery['fields']['rev_user'] . ' >' . (int)( $max - $max / 100 ); # ignore local groups with the bot right # @todo FIXME: Global groups may have 'bot' rights $groupsWithBotPermission = User::getGroupsWithPermission( 'bot' ); @@ -195,7 +195,7 @@ class ContribsPager extends RangeChronologicalPager { $queryInfo['conds'][] = 'ug_group IS NULL'; $queryInfo['join_conds']['user_groups'] = [ 'LEFT JOIN', [ - 'ug_user = rev_user', + 'ug_user = ' . $revQuery['fields']['rev_user'], 'ug_group' => $groupsWithBotPermission, 'ug_expiry IS NULL OR ug_expiry >= ' . $this->mDb->addQuotes( $this->mDb->timestamp() ) @@ -208,23 +208,18 @@ class ContribsPager extends RangeChronologicalPager { $queryInfo['conds'][] = 'rev_timestamp > ' . $this->mDb->addQuotes( $this->mDb->timestamp( wfTimestamp() - 30 * 24 * 60 * 60 ) ); } else { - $uid = User::idFromName( $this->target ); - if ( $uid ) { - $queryInfo['conds']['rev_user'] = $uid; - $queryInfo['options']['USE INDEX']['revision'] = 'user_timestamp'; + $user = User::newFromName( $this->target, false ); + $ipRangeConds = $user->isAnon() ? $this->getIpRangeConds( $this->mDb, $this->target ) : null; + if ( $ipRangeConds ) { + $queryInfo['tables'][] = 'ip_changes'; + $queryInfo['join_conds']['ip_changes'] = [ + 'LEFT JOIN', [ 'ipc_rev_id = rev_id' ] + ]; + $queryInfo['conds'][] = $ipRangeConds; } else { - $ipRangeConds = $this->getIpRangeConds( $this->mDb, $this->target ); - - if ( $ipRangeConds ) { - $queryInfo['tables'][] = 'ip_changes'; - $queryInfo['join_conds']['ip_changes'] = [ - 'LEFT JOIN', [ 'ipc_rev_id = rev_id' ] - ]; - $queryInfo['conds'][] = $ipRangeConds; - } else { - $queryInfo['conds']['rev_user_text'] = $this->target; - $queryInfo['options']['USE INDEX']['revision'] = 'usertext_timestamp'; - } + // tables and joins are already handled by Revision::getQueryInfo() + $queryInfo['conds'][] = ActorMigration::newMigration() + ->getWhere( $this->mDb, 'rev_user', $user )['conds']; } } @@ -427,14 +422,14 @@ class ContribsPager extends RangeChronologicalPager { * we're definitely dealing with revision data and we may proceed, if not, we'll leave it * to extensions to subscribe to the hook to parse the row. */ - MediaWiki\suppressWarnings(); + Wikimedia\suppressWarnings(); try { $rev = new Revision( $row ); $validRevision = (bool)$rev->getId(); } catch ( Exception $e ) { $validRevision = false; } - MediaWiki\restoreWarnings(); + Wikimedia\restoreWarnings(); if ( $validRevision ) { $attribs['data-mw-revid'] = $rev->getId(); @@ -634,7 +629,7 @@ class ContribsPager extends RangeChronologicalPager { * @param array $opts Options array * @return array Options array with processed start and end date filter options */ - public static function processDateFilter( $opts ) { + public static function processDateFilter( array $opts ) { $start = isset( $opts['start'] ) ? $opts['start'] : ''; $end = isset( $opts['end'] ) ? $opts['end'] : ''; $year = isset( $opts['year'] ) ? $opts['year'] : '';