MediaWiki
REL1_20
|
00001 <?php 00029 class PopularPagesPage extends QueryPage { 00030 00031 function __construct( $name = 'Popularpages' ) { 00032 parent::__construct( $name ); 00033 } 00034 00035 function isExpensive() { 00036 # page_counter is not indexed 00037 return true; 00038 } 00039 00040 function isSyndicated() { return false; } 00041 00042 function getQueryInfo() { 00043 return array ( 00044 'tables' => array( 'page' ), 00045 'fields' => array( 'namespace' => 'page_namespace', 00046 'title' => 'page_title', 00047 'value' => 'page_counter'), 00048 'conds' => array( 'page_is_redirect' => 0, 00049 'page_namespace' => MWNamespace::getContentNamespaces() ) ); 00050 } 00051 00057 function formatResult( $skin, $result ) { 00058 global $wgContLang; 00059 00060 $title = Title::makeTitleSafe( $result->namespace, $result->title ); 00061 if( !$title ) { 00062 return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ), 00063 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) ); 00064 } 00065 00066 $link = Linker::linkKnown( 00067 $title, 00068 htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) 00069 ); 00070 $nv = $this->msg( 'nviews' )->numParams( $result->value )->escaped(); 00071 return $this->getLanguage()->specialList( $link, $nv ); 00072 } 00073 }