}
# Do a batch existence check
- $batch = new LinkBatch;
- foreach ( $templates as $title ) {
- $batch->addObj( $title );
- }
- $batch->execute();
+ ( new LinkBatch( $templates ) )->execute();
# Construct the HTML
$outText = '<div class="mw-templatesUsedExplanation">';
}
if ( $this->mOldRestrictions === false ) {
- $this->mOldRestrictions = $dbr->selectField( 'page', 'page_restrictions',
- [ 'page_id' => $this->getArticleID() ], __METHOD__ );
+ $linkCache = MediaWikiServices::getInstance()->getLinkCache();
+ $linkCache->addLinkObj( $this ); # in case we already had an article ID
+ $this->mOldRestrictions = $linkCache->getGoodLinkFieldObj( $this, 'restrictions' );
}
if ( $this->mOldRestrictions != '' ) {
'revision' => (int)$revision,
'model' => $model ? (string)$model : null,
'lang' => $lang ? (string)$lang : null,
+ 'restrictions' => null
] );
}
'length' => intval( $row->page_len ),
'redirect' => intval( $row->page_is_redirect ),
'revision' => intval( $row->page_latest ),
- 'model' => !empty( $row->page_content_model ) ? strval( $row->page_content_model ) : null,
- 'lang' => !empty( $row->page_lang ) ? strval( $row->page_lang ) : null,
+ 'model' => !empty( $row->page_content_model )
+ ? strval( $row->page_content_model )
+ : null,
+ 'lang' => !empty( $row->page_lang )
+ ? strval( $row->page_lang )
+ : null,
+ 'restrictions' => !empty( $row->page_restrictions )
+ ? strval( $row->page_restrictions )
+ : null
] );
}
public static function getSelectFields() {
global $wgContentHandlerUseDB, $wgPageLanguageUseDB;
- $fields = [ 'page_id', 'page_len', 'page_is_redirect', 'page_latest' ];
+ $fields = [
+ 'page_id',
+ 'page_len',
+ 'page_is_redirect',
+ 'page_latest',
+ 'page_restrictions'
+ ];
if ( $wgContentHandlerUseDB ) {
$fields[] = 'page_content_model';
}