* (bug 9556) Update Bulgarian translations
[mediawiki.git] / includes / SpecialFewestrevisions.php
blob160f371c51dbfefd129d8296537cb045df89a9ae
1 <?php
3 /**
5 * Special page for listing the articles with the fewest revisions.
6 *
7 * @package MediaWiki
8 * @subpackage Special pages
9 * @author Martin Drashkov
12 class FewestrevisionsPage extends QueryPage {
14 function getName() {
15 return 'Fewestrevisions';
18 function isExpensive() {
19 return true;
22 function isSyndicated() {
23 return false;
26 function getSql() {
27 $dbr = wfGetDB( DB_SLAVE );
28 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
30 return "SELECT 'Fewestrevisions' as type,
31 page_namespace as namespace,
32 page_title as title,
33 COUNT(*) as value
34 FROM $revision
35 JOIN $page ON page_id = rev_page
36 WHERE page_namespace = " . NS_MAIN . "
37 GROUP BY 1,2,3
38 HAVING COUNT(*) > 1";
41 function sortDescending() {
42 return false;
45 function formatResult( $skin, $result ) {
46 global $wgLang, $wgContLang;
48 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
49 $text = $wgContLang->convert( $nt->getPrefixedText() );
51 $plink = $skin->makeKnownLinkObj( $nt, $text );
53 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
54 $wgLang->formatNum( $result->value ) );
55 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
57 return wfSpecialList( $plink, $nlink );
61 function wfSpecialFewestrevisions() {
62 list( $limit, $offset ) = wfCheckLimits();
63 $frp = new FewestrevisionsPage();
64 $frp->doQuery( $offset, $limit );