fixed broken sidebar
[lhc/web/wiklou.git] / includes / SpecialPopularpages.php
1 <?php
2 /**
3 *
4 * @package MediaWiki
5 * @subpackage SpecialPage
6 */
7
8 /**
9 *
10 */
11 require_once( "QueryPage.php" );
12
13 /**
14 *
15 * @package MediaWiki
16 * @subpackage SpecialPage
17 */
18 class PopularPagesPage extends QueryPage {
19
20 function getName() {
21 return "Popularpages";
22 }
23
24 function isExpensive() {
25 # page_counter is not indexed
26 return true;
27 }
28 function isSyndicated() { return false; }
29
30 function getSQL() {
31 $dbr =& wfGetDB( DB_SLAVE );
32 $page = $dbr->tableName( 'page' );
33
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";
41 }
42
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgContLang;
45 $title = Title::makeTitle( $result->namespace, $result->title );
46 $link = $skin->makeKnownLinkObj( $title, $wgContLang->convert( $title->getPrefixedText() ) );
47 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
48 return "{$link} ({$nv})";
49 }
50 }
51
52 /**
53 * Constructor
54 */
55 function wfSpecialPopularpages() {
56 list( $limit, $offset ) = wfCheckLimits();
57
58 $ppp = new PopularPagesPage();
59
60 return $ppp->doQuery( $offset, $limit );
61 }
62
63 ?>