private $pageRestrictions, $pageIsRedir, $pageIsNew, $pageTouched,
$pageLatest, $pageLength;
- private $protections, $watched, $watchers, $notificationtimestamps,
+ private $protections, $restrictionTypes, $watched, $watchers, $notificationtimestamps,
$talkids, $subjectids, $displaytitles;
private $showZeroWatchers = false;
*/
public function requestExtraData( $pageSet ) {
$pageSet->requestField( 'page_restrictions' );
- // when resolving redirects, no page will have this field
- if ( !$pageSet->isResolvingRedirects() ) {
- $pageSet->requestField( 'page_is_redirect' );
- }
+ // If the pageset is resolving redirects we won't get page_is_redirect.
+ // But we can't know for sure until the pageset is executed (revids may
+ // turn it off), so request it unconditionally.
+ $pageSet->requestField( 'page_is_redirect' );
$pageSet->requestField( 'page_is_new' );
$config = $this->getConfig();
$pageSet->requestField( 'page_touched' );
'import' => array( 'ApiQueryInfo', 'getImportToken' ),
'watch' => array( 'ApiQueryInfo', 'getWatchToken' ),
);
- wfRunHooks( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
+ Hooks::run( 'APIQueryInfoTokens', array( &$this->tokenFunctions ) );
return $this->tokenFunctions;
}
$this->protections[$ns][$dbkey];
}
$this->getResult()->setIndexedTagName( $pageInfo['protection'], 'pr' );
+
+ $pageInfo['restrictiontypes'] = array();
+ if ( isset( $this->restrictionTypes[$ns][$dbkey] ) ) {
+ $pageInfo['restrictiontypes'] =
+ $this->restrictionTypes[$ns][$dbkey];
+ }
+ $this->getResult()->setIndexedTagName( $pageInfo['restrictiontypes'], 'rt' );
}
if ( $this->fld_watched && isset( $this->watched[$ns][$dbkey] ) ) {
$pageInfo['preload'] = '';
} else {
$text = null;
- wfRunHooks( 'EditFormPreloadText', array( &$text, &$title ) );
+ Hooks::run( 'EditFormPreloadText', array( &$text, &$title ) );
$pageInfo['preload'] = $text;
}
}
}
- // Cascading protections
+ // Separate good and missing titles into files and other pages
+ // and populate $this->restrictionTypes
$images = $others = array();
foreach ( $this->everything as $title ) {
if ( $title->getNamespace() == NS_FILE ) {
} else {
$others[] = $title;
}
+ // Applicable protection types
+ $this->restrictionTypes[$title->getNamespace()][$title->getDBkey()] =
+ array_values( $title->getRestrictionTypes() );
}
if ( count( $others ) ) {
'displaytitle',
// If you add more properties here, please consider whether they
// need to be added to getCacheMode()
- ) ),
+ ),
+ ApiBase::PARAM_HELP_MSG_PER_VALUE => array(),
+ ),
'token' => array(
ApiBase::PARAM_DEPRECATED => true,
ApiBase::PARAM_DFLT => null,