Add call to GenderCache in list=allpages
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 8 Jun 2012 12:24:39 +0000 (14:24 +0200)
committerGerrit Code Review <gerrit@wikimedia.org>
Sun, 8 Jul 2012 14:44:30 +0000 (14:44 +0000)
Without this call, each user page can produce a query to get the gender
state.

Change-Id: I430c9922008cfea57b02da112087a7d52aeb4d23

includes/api/ApiQueryAllPages.php

index cfc22ff..dec3d8a 100644 (file)
@@ -165,6 +165,16 @@ class ApiQueryAllPages extends ApiQueryGeneratorBase {
                $this->addOption( 'LIMIT', $limit + 1 );
                $res = $this->select( __METHOD__ );
 
+               //Get gender information
+               if( MWNamespace::hasGenderDistinction( $params['namespace'] ) ) {
+                       $users = array();
+                       foreach ( $res as $row ) {
+                               $users[] = $row->page_title;
+                       }
+                       GenderCache::singleton()->doQuery( $users, __METHOD__ );
+                       $res->rewind(); //reset
+               }
+
                $count = 0;
                $result = $this->getResult();
                foreach ( $res as $row ) {