revert to Wiki.php 1.28 and index.php 1.130
[mediawiki.git] / includes / SpecialPopularpages.php
blob7a9557daa5888d04e1c9abc29ec90f7d9ac08719
1 <?php
2 /**
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
8 /**
11 require_once( "QueryPage.php" );
13 /**
15 * @package MediaWiki
16 * @subpackage SpecialPage
18 class PopularPagesPage extends QueryPage {
20 function getName() {
21 return "Popularpages";
24 function isExpensive() {
25 # page_counter is not indexed
26 return true;
28 function isSyndicated() { return false; }
30 function getSQL() {
31 $dbr =& wfGetDB( DB_SLAVE );
32 $page = $dbr->tableName( 'page' );
34 return
35 "SELECT 'Popularpages' as type,
36 page_namespace as namespace,
37 page_title as title,
38 page_counter as value
39 FROM $page
40 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgContLang;
45 $title = Title::makeTitle( $result->namespace, $result->title );
46 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
47 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
48 return "{$link} ({$nv})";
52 /**
53 * Constructor
55 function wfSpecialPopularpages() {
56 list( $limit, $offset ) = wfCheckLimits();
58 $ppp = new PopularPagesPage();
60 return $ppp->doQuery( $offset, $limit );