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