ContribsPager: Check if target is an IP range outside foreach loop
authorMusikAnimal <musikanimal@gmail.com>
Thu, 7 Sep 2017 02:29:06 +0000 (22:29 -0400)
committerMusikAnimal <musikanimal@gmail.com>
Thu, 7 Sep 2017 02:29:36 +0000 (22:29 -0400)
Follow up to https://gerrit.wikimedia.org/r/#/c/376449/

Change-Id: I5151c10569a92805f79b59f68f9c57c451dc4598

includes/specials/pagers/ContribsPager.php

index 31ea810..979460c 100644 (file)
@@ -384,6 +384,7 @@ class ContribsPager extends RangeChronologicalPager {
                $parentRevIds = [];
                $this->mParentLens = [];
                $batch = new LinkBatch();
+               $isIpRange = $this->isQueryableRange( $this->target );
                # Give some pointers to make (last) links
                foreach ( $this->mResult as $row ) {
                        if ( isset( $row->rev_parent_id ) && $row->rev_parent_id ) {
@@ -394,7 +395,7 @@ class ContribsPager extends RangeChronologicalPager {
                                if ( $this->contribs === 'newbie' ) { // multiple users
                                        $batch->add( NS_USER, $row->user_name );
                                        $batch->add( NS_USER_TALK, $row->user_name );
-                               } elseif ( $this->isQueryableRange( $this->target ) ) {
+                               } elseif ( $isIpRange ) {
                                        // If this is an IP range, batch the IP's talk page
                                        $batch->add( NS_USER_TALK, $row->rev_user_text );
                                }