This is giving me a syntax error. It looks gross this way, but I can't think of any...
[lhc/web/wiklou.git] / includes / SpecialFewestrevisions.php
1 <?php
2
3 /**
4 * Special page for listing the articles with the fewest revisions.
5 *
6 * @package MediaWiki
7 * @addtogroup SpecialPage
8 * @author Martin Drashkov
9 */
10 class FewestrevisionsPage extends QueryPage {
11
12 function getName() {
13 return 'Fewestrevisions';
14 }
15
16 function isExpensive() {
17 return true;
18 }
19
20 function isSyndicated() {
21 return false;
22 }
23
24 function getSql() {
25 $dbr = wfGetDB( DB_SLAVE );
26 list( $revision, $page ) = $dbr->tableNamesN( 'revision', 'page' );
27
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";
37 }
38
39 function sortDescending() {
40 return false;
41 }
42
43 function formatResult( $skin, $result ) {
44 global $wgLang, $wgContLang;
45
46 $nt = Title::makeTitleSafe( $result->namespace, $result->title );
47 $text = $wgContLang->convert( $nt->getPrefixedText() );
48
49 $plink = $skin->makeKnownLinkObj( $nt, $text );
50
51 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
52 $wgLang->formatNum( $result->value ) );
53 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
54
55 return wfSpecialList( $plink, $nlink );
56 }
57 }
58
59 function wfSpecialFewestrevisions() {
60 list( $limit, $offset ) = wfCheckLimits();
61 $frp = new FewestrevisionsPage();
62 $frp->doQuery( $offset, $limit );
63 }
64
65