MediaWiki  REL1_21
SpecialPopularpages.php
Go to the documentation of this file.
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() {
00041                 return false;
00042         }
00043 
00044         function getQueryInfo() {
00045                 return array (
00046                         'tables' => array( 'page' ),
00047                         'fields' => array( 'namespace' => 'page_namespace',
00048                                         'title' => 'page_title',
00049                                         'value' => 'page_counter' ),
00050                         'conds' => array( 'page_is_redirect' => 0,
00051                                         'page_namespace' => MWNamespace::getContentNamespaces() ) );
00052         }
00053 
00059         function formatResult( $skin, $result ) {
00060                 global $wgContLang;
00061 
00062                 $title = Title::makeTitleSafe( $result->namespace, $result->title );
00063                 if( !$title ) {
00064                         return Html::element( 'span', array( 'class' => 'mw-invalidtitle' ),
00065                                 Linker::getInvalidTitleDescription( $this->getContext(), $result->namespace, $result->title ) );
00066                 }
00067 
00068                 $link = Linker::linkKnown(
00069                         $title,
00070                         htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
00071                 );
00072                 $nv = $this->msg( 'nviews' )->numParams( $result->value )->escaped();
00073                 return $this->getLanguage()->specialList( $link, $nv );
00074         }
00075 
00076         protected function getGroupName() {
00077                 return 'wiki';
00078         }
00079 }