summaryrefslogtreecommitdiff
path: root/includes/api/ApiPageSet.php
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
committerPierre Schmitz <pierre@archlinux.de>2013-01-18 16:46:04 +0100
commit63601400e476c6cf43d985f3e7b9864681695ed4 (patch)
treef7846203a952e38aaf66989d0a4702779f549962 /includes/api/ApiPageSet.php
parent8ff01378c9e0207f9169b81966a51def645b6a51 (diff)
Update to MediaWiki 1.20.2
this update includes: * adjusted Arch Linux skin * updated FluxBBAuthPlugin * patch for https://bugzilla.wikimedia.org/show_bug.cgi?id=44024
Diffstat (limited to 'includes/api/ApiPageSet.php')
-rw-r--r--includes/api/ApiPageSet.php30
1 files changed, 24 insertions, 6 deletions
diff --git a/includes/api/ApiPageSet.php b/includes/api/ApiPageSet.php
index 7b84c473..0f5be6b2 100644
--- a/includes/api/ApiPageSet.php
+++ b/includes/api/ApiPageSet.php
@@ -4,7 +4,7 @@
*
* Created on Sep 24, 2006
*
- * Copyright © 2006 Yuri Astrakhan <Firstname><Lastname>@gmail.com
+ * Copyright © 2006 Yuri Astrakhan "<Firstname><Lastname>@gmail.com"
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -52,7 +52,7 @@ class ApiPageSet extends ApiQueryBase {
/**
* Constructor
- * @param $query ApiQueryBase
+ * @param $query ApiBase
* @param $resolveRedirects bool Whether redirects should be resolved
* @param $convertTitles bool
*/
@@ -266,8 +266,8 @@ class ApiPageSet extends ApiQueryBase {
}
/**
- * Returns the number of revisions (requested with revids= parameter)\
- * @return int
+ * Returns the number of revisions (requested with revids= parameter).
+ * @return int Number of revisions.
*/
public function getRevisionCount() {
return count( $this->getRevisionIDs() );
@@ -342,7 +342,7 @@ class ApiPageSet extends ApiQueryBase {
/**
* Populate this PageSet from a rowset returned from the database
- * @param $db Database object
+ * @param $db DatabaseBase object
* @param $queryResult ResultWrapper Query result object
*/
public function populateFromQueryResult( $db, $queryResult ) {
@@ -367,7 +367,7 @@ class ApiPageSet extends ApiQueryBase {
*/
public function processDbRow( $row ) {
// Store Title object in various data structures
- $title = Title::makeTitle( $row->page_namespace, $row->page_title );
+ $title = Title::newFromRow( $row );
$pageId = intval( $row->page_id );
$this->mAllPages[$row->page_namespace][$row->page_title] = $pageId;
@@ -481,6 +481,7 @@ class ApiPageSet extends ApiQueryBase {
ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' );
}
+ $usernames = array();
if ( $res ) {
foreach ( $res as $row ) {
$pageId = intval( $row->page_id );
@@ -496,6 +497,11 @@ class ApiPageSet extends ApiQueryBase {
// Store any extra fields requested by modules
$this->processDbRow( $row );
+
+ // Need gender information
+ if( MWNamespace::hasGenderDistinction( $row->page_namespace ) ) {
+ $usernames[] = $row->page_title;
+ }
}
}
@@ -510,6 +516,11 @@ class ApiPageSet extends ApiQueryBase {
$this->mMissingTitles[$this->mFakePageId] = $title;
$this->mFakePageId--;
$this->mTitles[] = $title;
+
+ // need gender information
+ if( MWNamespace::hasGenderDistinction( $ns ) ) {
+ $usernames[] = $dbkey;
+ }
}
}
} else {
@@ -521,6 +532,10 @@ class ApiPageSet extends ApiQueryBase {
}
}
}
+
+ // Get gender information
+ $genderCache = GenderCache::singleton();
+ $genderCache->doQuery( $usernames, __METHOD__ );
}
/**
@@ -664,6 +679,9 @@ class ApiPageSet extends ApiQueryBase {
* @return LinkBatch
*/
private function processTitlesArray( $titles ) {
+ $genderCache = GenderCache::singleton();
+ $genderCache->doTitlesArray( $titles, __METHOD__ );
+
$linkBatch = new LinkBatch();
foreach ( $titles as $title ) {