preview note
[lhc/web/wiklou.git] / includes / SpecialPopularpages.php
1 <?php
2
3 require_once( "QueryPage.php" );
4
5 class PopularPagesPage extends QueryPage {
6
7 function getName() {
8 return "Popularpages";
9 }
10
11 function isExpensive() {
12 # cur_counter is not indexed
13 return true;
14 }
15
16 function getSQL() {
17 return
18 "SELECT 'Popularpages' as type,
19 cur_namespace as namespace,
20 cur_title as title,
21 cur_counter as value
22 FROM cur
23 WHERE cur_namespace=0 AND cur_is_redirect=0";
24 }
25
26 function formatResult( $skin, $result ) {
27 global $wgLang;
28 $link = $skin->makeKnownLink( $result->title, "" );
29 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
30 return "{$link} ({$nv})";
31 }
32 }
33
34 function wfSpecialPopularpages()
35 {
36 list( $limit, $offset ) = wfCheckLimits();
37
38 $ppp = new PopularPagesPage();
39
40 return $ppp->doQuery( $offset, $limit );
41 }
42
43 ?>