Separate the Special:Preferences title and the link to the preferences from the perso...
[lhc/web/wiklou.git] / includes / SpecialMostrevisions.php
1 <?php
2 /**
3 * A special page to show pages in the
4 *
5 * @package MediaWiki
6 * @subpackage SpecialPage
7 *
8 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
9 * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
10 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
11 */
12
13 /**
14 * @package MediaWiki
15 * @subpackage SpecialPage
16 */
17 class MostrevisionsPage extends QueryPage {
18
19 function getName() { return 'Mostrevisions'; }
20 function isExpensive() { return true; }
21 function isSyndicated() { return false; }
22
23 function getSQL() {
24 $dbr =& wfGetDB( DB_SLAVE );
25 extract( $dbr->tableNames( 'revision', 'page' ) );
26 return
27 "
28 SELECT
29 'Mostrevisions' as type,
30 page_namespace as namespace,
31 page_title as title,
32 COUNT(*) as value
33 FROM $revision
34 JOIN $page ON page_id = rev_page
35 WHERE page_namespace = " . NS_MAIN . "
36 GROUP BY 1,2,3
37 HAVING COUNT(*) > 1
38 ";
39 }
40
41 function formatResult( $skin, $result ) {
42 global $wgLang, $wgContLang;
43
44 $nt = Title::makeTitle( $result->namespace, $result->title );
45 $text = $wgContLang->convert( $nt->getPrefixedText() );
46
47 $plink = $skin->makeKnownLinkObj( $nt, $text );
48
49 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
50 $wgLang->formatNum( $result->value ) );
51 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
52
53 return wfSpecialList($plink, $nlink);
54 }
55 }
56
57 /**
58 * constructor
59 */
60 function wfSpecialMostrevisions() {
61 list( $limit, $offset ) = wfCheckLimits();
62
63 $wpp = new MostrevisionsPage();
64
65 $wpp->doQuery( $offset, $limit );
66 }
67
68 ?>