MediaWiki  REL1_19
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() { return false; }
00041 
00042         function getQueryInfo() {
00043                 return array (
00044                         'tables' => array( 'page' ),
00045                         'fields' => array( 'page_namespace AS namespace',
00046                                         'page_title AS title',
00047                                         'page_counter AS value'),
00048                         'conds' => array( 'page_is_redirect' => 0,
00049                                         'page_namespace' => MWNamespace::getContentNamespaces() ) );
00050         }
00051 
00057         function formatResult( $skin, $result ) {
00058                 global $wgContLang;
00059                 $title = Title::makeTitle( $result->namespace, $result->title );
00060                 $link = Linker::linkKnown(
00061                         $title,
00062                         htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) )
00063                 );
00064                 $nv = $this->msg( 'nviews' )->numParams( $result->value )->escaped();
00065                 return $this->getLanguage()->specialList( $link, $nv );
00066         }
00067 }