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