new wfMsg* functions to use the wgContLang object for translating content related...
[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 # cur_counter is not indexed
26 return true;
27 }
28
29 function getSQL() {
30 $dbr =& wfGetDB( DB_SLAVE );
31 $cur = $dbr->tableName( 'cur' );
32
33 return
34 "SELECT 'Popularpages' as type,
35 cur_namespace as namespace,
36 cur_title as title,
37 cur_counter as value
38 FROM $cur
39 WHERE cur_namespace=0 AND cur_is_redirect=0";
40 }
41
42 function formatResult( $skin, $result ) {
43 global $wgLang;
44 $link = $skin->makeKnownLink( $result->title, "" );
45 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
46 return "{$link} ({$nv})";
47 }
48 }
49
50 /**
51 * Constructor
52 */
53 function wfSpecialPopularpages() {
54 list( $limit, $offset ) = wfCheckLimits();
55
56 $ppp = new PopularPagesPage();
57
58 return $ppp->doQuery( $offset, $limit );
59 }
60
61 ?>