use Database::timestamp() for cutoff
[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 $dbr =& wfGetDB( DB_SLAVE );
18 $cur = $dbr->tableName( 'cur' );
19
20 return
21 "SELECT 'Popularpages' as type,
22 cur_namespace as namespace,
23 cur_title as title,
24 cur_counter as value
25 FROM $cur
26 WHERE cur_namespace=0 AND cur_is_redirect=0";
27 }
28
29 function formatResult( $skin, $result ) {
30 global $wgLang;
31 $link = $skin->makeKnownLink( $result->title, "" );
32 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
33 return "{$link} ({$nv})";
34 }
35 }
36
37 function wfSpecialPopularpages()
38 {
39 list( $limit, $offset ) = wfCheckLimits();
40
41 $ppp = new PopularPagesPage();
42
43 return $ppp->doQuery( $offset, $limit );
44 }
45
46 ?>