Fix regression in even sizing of diff columns; forgot to restore a couple bits I...
[mediawiki.git] / includes / SpecialFewestrevisions.php
blob4c0cd686e5af4df3180d44eabd69e8034e0d8a45
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 );