* Fixed E_NOTICE..
[mediawiki.git] / includes / SpecialMostrevisions.php
blob9479a5838829c66ad99e445c8a418bade4220b01
1 <?php
2 /**
3 * A special page to show pages in the
5 * @addtogroup SpecialPage
7 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
8 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
9 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
12 /**
13 * @addtogroup SpecialPage
15 class MostrevisionsPage extends QueryPage {
17 function getName() { return 'Mostrevisions'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
21 function getSQL() {
22 $dbr = wfGetDB( DB_SLAVE );
23 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
24 return
26 SELECT
27 'Mostrevisions' as type,
28 page_namespace as namespace,
29 page_title as title,
30 COUNT(*) as value
31 FROM $revision
32 JOIN $page ON page_id = rev_page
33 WHERE page_namespace = " . NS_MAIN . "
34 GROUP BY 1,2,3
35 HAVING COUNT(*) > 1
39 function formatResult( $skin, $result ) {
40 global $wgLang, $wgContLang;
42 $nt = Title::makeTitle( $result->namespace, $result->title );
43 $text = $wgContLang->convert( $nt->getPrefixedText() );
45 $plink = $skin->makeKnownLinkObj( $nt, $text );
47 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
48 $wgLang->formatNum( $result->value ) );
49 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
51 return wfSpecialList($plink, $nlink);
55 /**
56 * constructor
58 function wfSpecialMostrevisions() {
59 list( $limit, $offset ) = wfCheckLimits();
61 $wpp = new MostrevisionsPage();
63 $wpp->doQuery( $offset, $limit );