More profile breakage.
[mediawiki.git] / includes / SpecialFewestrevisions.php
blobba6db8b6a153b32d1ddf059fb5fde8c978640519
1 <?php
3 /**
4 * Special page for listing the articles with the fewest revisions.
6 * @package MediaWiki
7 * @addtogroup SpecialPage
8 * @author Martin Drashkov
9 */
10 class FewestrevisionsPage extends QueryPage {
12 function getName() {
13 return 'Fewestrevisions';
16 function isExpensive() {
17 return true;
20 function isSyndicated() {
21 return false;
24 function getSql() {
25 $dbr = wfGetDB( DB_SLAVE );
26 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
28 return "SELECT 'Fewestrevisions' as type,
29 page_namespace as namespace,
30 page_title as title,
31 COUNT(*) as value
32 FROM $revision
33 JOIN $page ON page_id = rev_page
34 WHERE page_namespace = " . NS_MAIN . "
35 GROUP BY 1,2,3
36 HAVING COUNT(*) > 1";
39 function sortDescending() {
40 return false;
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgContLang;
46 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
47 $text = $wgContLang->convert( $nt->getPrefixedText() );
49 $plink = $skin->makeKnownLinkObj( $nt, $text );
51 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
52 $wgLang->formatNum( $result->value ) );
53 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
55 return wfSpecialList( $plink, $nlink );
59 function wfSpecialFewestrevisions() {
60 list( $limit, $offset ) = wfCheckLimits();
61 $frp = new FewestrevisionsPage();
62 $frp->doQuery( $offset, $limit );