}
public function getQueryInfo() {
- $tables = array( 'page' );
- $conds = array(
+ $tables = [ 'page' ];
+ $conds = [
'page_namespace' => MWNamespace::getContentNamespaces(),
'page_is_redirect' => 0
- );
- $joinConds = array();
- $options = array( 'USE INDEX' => array( 'page' => 'page_redirect_namespace_len' ) );
+ ];
+ $joinConds = [];
+ $options = [ 'USE INDEX' => [ 'page' => 'page_redirect_namespace_len' ] ];
// Allow extensions to modify the query
- Hooks::run( 'ShortPagesQuery', array( &$tables, &$conds, &$joinConds, &$options ) );
+ Hooks::run( 'ShortPagesQuery', [ &$tables, &$conds, &$joinConds, &$options ] );
- return array(
+ return [
'tables' => $tables,
- 'fields' => array(
+ 'fields' => [
'namespace' => 'page_namespace',
'title' => 'page_title',
'value' => 'page_len'
- ),
+ ],
'conds' => $conds,
'join_conds' => $joinConds,
'options' => $options
- );
+ ];
}
function getOrderFields() {
- return array( 'page_len' );
+ return [ 'page_len' ];
}
/**
* @param ResultWrapper $res
*/
function preprocessResults( $db, $res ) {
- # There's no point doing a batch check if we aren't caching results;
- # the page must exist for it to have been pulled out of the table
- if ( !$this->isCached() || !$res->numRows() ) {
- return;
- }
-
- $batch = new LinkBatch();
- foreach ( $res as $row ) {
- $batch->add( $row->namespace, $row->title );
- }
- $batch->execute();
-
- $res->seek( 0 );
+ $this->executeLBFromResultWrapper( $res );
}
function sortDescending() {
$title = Title::makeTitleSafe( $result->namespace, $result->title );
if ( !$title ) {
- return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
+ return Html::element( 'span', [ 'class' => 'mw-invalidtitle' ],
Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
}
- $hlink = Linker::linkKnown(
+ $linkRenderer = $this->getLinkRenderer();
+ $hlink = $linkRenderer->makeKnownLink(
$title,
- $this->msg( 'hist' )->escaped(),
- array(),
- array( 'action' => 'history' )
+ $this->msg( 'hist' )->text(),
+ [],
+ [ 'action' => 'history' ]
);
$hlinkInParentheses = $this->msg( 'parentheses' )->rawParams( $hlink )->escaped();
if ( $this->isCached() ) {
- $plink = Linker::link( $title );
+ $plink = $linkRenderer->makeLink( $title );
$exists = $title->exists();
} else {
- $plink = Linker::linkKnown( $title );
+ $plink = $linkRenderer->makeKnownLink( $title );
$exists = true;
}