* Added a test for a link with multiple pipes
[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 $link = $skin->makeKnownLink( $result->title, $wgContLang->convert( $result->title ) );
46 $nv = wfMsg( "nviews", $wgLang->formatNum( $result->value ) );
47 return "{$link} ({$nv})";
48 }
49 }
50
51 /**
52 * Constructor
53 */
54 function wfSpecialPopularpages() {
55 list( $limit, $offset ) = wfCheckLimits();
56
57 $ppp = new PopularPagesPage();
58
59 return $ppp->doQuery( $offset, $limit );
60 }
61
62 ?>