Change various uses of GROUP BY 1,2,3 and similar to use the actual column names...
[lhc/web/wiklou.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->makeKnownLinkObj( $nt, $text );
46
47 $nl = wfMsgExt( 'nrevisions', array( 'parsemag', 'escape'),
48 $wgLang->formatNum( $result->value ) );
49 $nlink = $skin->makeKnownLinkObj( $nt, $nl, 'action=history' );
50
51 return wfSpecialList($plink, $nlink);
52 }
53 }
54
55 /**
56 * constructor
57 */
58 function wfSpecialMostrevisions() {
59 list( $limit, $offset ) = wfCheckLimits();
60
61 $wpp = new MostrevisionsPage();
62
63 $wpp->doQuery( $offset, $limit );
64 }