array ( 'page' ), 'fields' => array ( 'page_namespace AS namespace', 'page_title AS title', 'page_len AS value' ), 'conds' => array ( 'page_namespace' => MWNamespace::getContentNamespaces(), 'page_is_redirect' => 0 ), 'options' => array ( 'USE INDEX' => 'page_len' ) ); } function getOrderFields() { return array( 'page_len' ); } /** * @param $db DatabaseBase * @param $res * @return void */ 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() ) { $batch = new LinkBatch(); foreach ( $res as $row ) { $batch->add( $row->namespace, $row->title ); } $batch->execute(); if ( $db->numRows( $res ) > 0 ) { $db->dataSeek( $res, 0 ); } } } function sortDescending() { return false; } function formatResult( $skin, $result ) { global $wgLang; $dm = $wgLang->getDirMark(); $title = Title::makeTitle( $result->namespace, $result->title ); if ( !$title ) { return ''; } $hlink = $skin->linkKnown( $title, wfMsgHtml( 'hist' ), array(), array( 'action' => 'history' ) ); $plink = $this->isCached() ? $skin->link( $title ) : $skin->linkKnown( $title ); $size = wfMessage( 'nbytes', $wgLang->formatNum( $result->value ) )->escaped(); return $title->exists() ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" : "({$hlink}) {$dm}{$plink} {$dm}[{$size}]"; } }