-
- if ( $this->contribs == 'newbie' ) {
- $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 = MediaWikiServices::getInstance()
- ->getPermissionManager()
- ->getGroupsWithPermission( 'bot' );
- if ( count( $groupsWithBotPermission ) ) {
- $queryInfo['tables'][] = 'user_groups';
- $queryInfo['conds'][] = 'ug_group IS NULL';
- $queryInfo['join_conds']['user_groups'] = [
- 'LEFT JOIN', [
- 'ug_user = ' . $revQuery['fields']['rev_user'],
- 'ug_group' => $groupsWithBotPermission,
- 'ug_expiry IS NULL OR ug_expiry >= ' .
- $this->mDb->addQuotes( $this->mDb->timestamp() )
- ]
- ];
- }
- // (T140537) Disallow looking too far in the past for 'newbies' queries. If the user requested
- // a timestamp offset far in the past such that there are no edits by users with user_ids in
- // the range, we would end up scanning all revisions from that offset until start of time.
- $queryInfo['conds'][] = 'rev_timestamp > ' .
- $this->mDb->addQuotes( $this->mDb->timestamp( wfTimestamp() - 30 * 24 * 60 * 60 ) );
+ $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;