MediaWiki
REL1_19
|
00001 <?php 00030 class ShortPagesPage extends QueryPage { 00031 00032 function __construct( $name = 'Shortpages' ) { 00033 parent::__construct( $name ); 00034 } 00035 00036 function isSyndicated() { 00037 return false; 00038 } 00039 00040 function getQueryInfo() { 00041 return array ( 00042 'tables' => array ( 'page' ), 00043 'fields' => array ( 'page_namespace AS namespace', 00044 'page_title AS title', 00045 'page_len AS value' ), 00046 'conds' => array ( 'page_namespace' => NS_MAIN, 00047 'page_is_redirect' => 0 ), 00048 'options' => array ( 'USE INDEX' => 'page_redirect_namespace_len' ) 00049 ); 00050 } 00051 00052 function getOrderFields() { 00053 return array( 'page_len' ); 00054 } 00055 00061 function preprocessResults( $db, $res ) { 00062 # There's no point doing a batch check if we aren't caching results; 00063 # the page must exist for it to have been pulled out of the table 00064 if( $this->isCached() ) { 00065 $batch = new LinkBatch(); 00066 foreach ( $res as $row ) { 00067 $batch->add( $row->namespace, $row->title ); 00068 } 00069 $batch->execute(); 00070 if ( $db->numRows( $res ) > 0 ) { 00071 $db->dataSeek( $res, 0 ); 00072 } 00073 } 00074 } 00075 00076 function sortDescending() { 00077 return false; 00078 } 00079 00080 function formatResult( $skin, $result ) { 00081 $dm = $this->getLanguage()->getDirMark(); 00082 00083 $title = Title::makeTitle( $result->namespace, $result->title ); 00084 if ( !$title ) { 00085 return '<!-- Invalid title ' . htmlspecialchars( "{$result->namespace}:{$result->title}" ). '-->'; 00086 } 00087 $hlink = Linker::linkKnown( 00088 $title, 00089 wfMsgHtml( 'hist' ), 00090 array(), 00091 array( 'action' => 'history' ) 00092 ); 00093 $plink = $this->isCached() 00094 ? Linker::link( $title ) 00095 : Linker::linkKnown( $title ); 00096 $size = $this->msg( 'nbytes' )->numParams( $result->value )->escaped(); 00097 00098 return $title->exists() 00099 ? "({$hlink}) {$dm}{$plink} {$dm}[{$size}]" 00100 : "<del>({$hlink}) {$dm}{$plink} {$dm}[{$size}]</del>"; 00101 } 00102 }