private $fld_protection = false, $fld_talkid = false,
$fld_subjectid = false, $fld_url = false,
$fld_readable = false, $fld_watched = false,
- $fld_preload = false;
+ $fld_preload = false, $fld_displaytitle = false;
public function __construct( $query, $moduleName ) {
parent::__construct( $query, $moduleName, 'in' );
$this->fld_url = isset( $prop['url'] );
$this->fld_readable = isset( $prop['readable'] );
$this->fld_preload = isset( $prop['preload'] );
+ $this->fld_displaytitle = isset( $prop['displaytitle'] );
}
$pageSet = $this->getPageSet();
$this->pageLatest = $pageSet->getCustomField( 'page_latest' );
$this->pageLength = $pageSet->getCustomField( 'page_len' );
- $db = $this->getDB();
// Get protection info if requested
if ( $this->fld_protection ) {
$this->getProtectionInfo();
if ( $this->fld_talkid || $this->fld_subjectid ) {
$this->getTSIDs();
}
+
+ if ( $this->fld_displaytitle ) {
+ $this->getDisplayTitle();
+ }
foreach ( $this->everything as $pageid => $title ) {
$pageInfo = $this->extractPageInfo( $pageid, $title );
$pageInfo['lastrevid'] = intval( $this->pageLatest[$pageid] );
$pageInfo['counter'] = intval( $this->pageCounter[$pageid] );
$pageInfo['length'] = intval( $this->pageLength[$pageid] );
+
if ( $this->pageIsRedir[$pageid] ) {
$pageInfo['redirect'] = '';
}
if ( $title->exists() ) {
$pageInfo['preload'] = '';
} else {
+ $text = null;
wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
$pageInfo['preload'] = $text;
}
}
+
+ if ( $this->fld_displaytitle ) {
+ if ( isset( $this->displaytitles[$title->getArticleId()] ) ) {
+ $pageInfo['displaytitle'] = $this->displaytitles[$title->getArticleId()];
+ } else {
+ $pageInfo['displaytitle'] = $title->getPrefixedText();
+ }
+ }
+
return $pageInfo;
}
*/
private function getTSIDs() {
$getTitles = $this->talkids = $this->subjectids = array();
- $db = $this->getDB();
+
foreach ( $this->everything as $t ) {
if ( MWNamespace::isTalk( $t->getNamespace() ) ) {
if ( $this->fld_subjectid ) {
if ( !count( $getTitles ) ) {
return;
}
+
+ $db = $this->getDB();
// Construct a custom WHERE clause that matches
// all titles in $getTitles
}
}
}
+
+ private function getDisplayTitle() {
+ $this->displaytitles = array();
+
+ $pageIds = array_keys( $this->titles );
+
+ if ( !count( $pageIds ) ) {
+ return;
+ }
+
+ $this->resetQueryParams();
+ $this->addTables( 'page_props' );
+ $this->addFields( array( 'pp_page', 'pp_value' ) );
+ $this->addWhereFld( 'pp_page', $pageIds );
+ $this->addWhereFld( 'pp_propname', 'displaytitle' );
+ $res = $this->select( __METHOD__ );
+
+ foreach ( $res as $row ) {
+ $this->displaytitles[$row->pp_page] = $row->pp_value;
+ }
+ }
/**
* Get information about watched status and put it in $this->watched
'subjectid',
'url',
'readable',
- 'preload'
+ 'preload',
+ 'displaytitle',
) ),
'token' => array(
ApiBase::PARAM_DFLT => null,
' subjectid - The page ID of the parent page for each talk page',
' url - Gives a full URL to the page, and also an edit URL',
' readable - Whether the user can read this page',
- ' preload - Gives the text returned by EditFormPreloadText'
+ ' preload - Gives the text returned by EditFormPreloadText',
+ ' displaytitle - Gives the way the page title is actually displayed',
),
'token' => 'Request a token to perform a data-modifying action on a page',
'continue' => 'When more results are available, use this to continue',