Check whether the username passed to makeTalkUrlDetails is valid to give a clearer...
[mediawiki.git] / includes / SpecialPopularpages.php
bloba4e509b33dd875ef6ae3f610ed7da8f4b131facf
1 <?php
2 /**
4 * @addtogroup SpecialPage
5 */
7 /**
9 * @addtogroup SpecialPage
11 class PopularPagesPage extends QueryPage {
13 function getName() {
14 return "Popularpages";
17 function isExpensive() {
18 # page_counter is not indexed
19 return true;
21 function isSyndicated() { return false; }
23 function getSQL() {
24 $dbr = wfGetDB( DB_SLAVE );
25 $page = $dbr->tableName( 'page' );
27 return
28 "SELECT 'Popularpages' as type,
29 page_namespace as namespace,
30 page_title as title,
31 page_counter as value
32 FROM $page
33 WHERE page_namespace=".NS_MAIN." AND page_is_redirect=0";
36 function formatResult( $skin, $result ) {
37 global $wgLang, $wgContLang;
38 $title = Title::makeTitle( $result->namespace, $result->title );
39 $link = $skin->makeKnownLinkObj( $title, htmlspecialchars( $wgContLang->convert( $title->getPrefixedText() ) ) );
40 $nv = wfMsgExt( 'nviews', array( 'parsemag', 'escape'),
41 $wgLang->formatNum( $result->value ) );
42 return wfSpecialList($link, $nv);
46 /**
47 * Constructor
49 function wfSpecialPopularpages() {
50 list( $limit, $offset ) = wfCheckLimits();
52 $ppp = new PopularPagesPage();
54 return $ppp->doQuery( $offset, $limit );