*
* 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
* @file
*/
-if ( !defined( 'MEDIAWIKI' ) ) {
- // Eclipse helper - will be ignored in production
- require_once( 'ApiQueryBase.php' );
-}
-
/**
* This class contains a list of pages that the client has requested.
* Initially, when the client passes in titles=, pageids=, or revisions=
/**
* Constructor
- * @param $query ApiQuery
+ * @param $query ApiBase
* @param $resolveRedirects bool Whether redirects should be resolved
* @param $convertTitles bool
*/
}
/**
- * 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() );
/**
* 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 ) {
*/
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;
__METHOD__ );
$this->profileDBOut();
}
-
+
$this->initFromQueryResult( $res, $remaining, false ); // process PageIDs
// Resolve any found redirects
ApiBase::dieDebug( __METHOD__, 'Missing $processTitles parameter when $remaining is provided' );
}
+ $usernames = array();
if ( $res ) {
foreach ( $res as $row ) {
$pageId = intval( $row->page_id );
// Store any extra fields requested by modules
$this->processDbRow( $row );
+
+ // Need gender information
+ if( MWNamespace::hasGenderDistinction( $row->page_namespace ) ) {
+ $usernames[] = $row->page_title;
+ }
}
}
$this->mMissingTitles[$this->mFakePageId] = $title;
$this->mFakePageId--;
$this->mTitles[] = $title;
+
+ // need gender information
+ if( MWNamespace::hasGenderDistinction( $ns ) ) {
+ $usernames[] = $dbkey;
+ }
}
}
} else {
}
}
}
+
+ // Get gender information
+ $genderCache = GenderCache::singleton();
+ $genderCache->doQuery( $usernames, __METHOD__ );
}
/**
// We found pages that aren't in the redirect table
// Add them
foreach ( $this->mPendingRedirectIDs as $id => $title ) {
- $article = new Article( $title );
- $rt = $article->insertRedirect();
+ $page = WikiPage::factory( $title );
+ $rt = $page->insertRedirect();
if ( !$rt ) {
// What the hell. Let's just ignore this
continue;
* @return LinkBatch
*/
private function processTitlesArray( $titles ) {
+ $genderCache = GenderCache::singleton();
+ $genderCache->doTitlesArray( $titles, __METHOD__ );
+
$linkBatch = new LinkBatch();
foreach ( $titles as $title ) {
return $array;
}
- protected function getAllowedParams() {
+ public function getAllowedParams() {
return array(
'titles' => array(
ApiBase::PARAM_ISMULTI => true
);
}
- protected function getParamDescription() {
+ public function getParamDescription() {
return array(
'titles' => 'A list of titles to work on',
'pageids' => 'A list of page IDs to work on',