Define $wgRateLimitsExcludedGroups to an empty array to avoid some PHP warnings,...
[mediawiki.git] / includes / SpecialFewestrevisions.php
blob5ad8136939575ddddfd4ec2d7db4f0d9f3f45069
1 <?php
2 /**
3 * @file
4 * @ingroup SpecialPage
5 */
7 /**
8 * Special page for listing the articles with the fewest revisions.
10 * @ingroup SpecialPage
11 * @author Martin Drashkov
13 class FewestrevisionsPage extends QueryPage {
15 function getName() {
16 return 'Fewestrevisions';
19 function isExpensive() {
20 return true;
23 function isSyndicated() {
24 return false;
27 function getSql() {
28 $dbr = wfGetDB( DB_SLAVE );
29 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
31 return "SELECT 'Fewestrevisions' as type,
32 page_namespace as namespace,
33 page_title as title,
34 COUNT(*) as value
35 FROM $revision
36 JOIN $page ON page_id = rev_page
37 WHERE page_namespace = " . NS_MAIN . "
38 GROUP BY 1,2,3
39 HAVING COUNT(*) > 1";
42 function sortDescending() {
43 return false;
46 function formatResult( $skin, $result ) {
47 global $wgLang, $wgContLang;
49 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
50 $text = $wgContLang->convert( $nt->getPrefixedText() );
52 $plink = $skin->makeKnownLinkObj( $nt, $text );
54 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
55 $wgLang->formatNum( $result->value ) );
56 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
58 return wfSpecialList( $plink, $nlink );
62 function wfSpecialFewestrevisions() {
63 list( $limit, $offset ) = wfCheckLimits();
64 $frp = new FewestrevisionsPage();
65 $frp->doQuery( $offset, $limit );