]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - includes/specials/SpecialMostimages.php
MediaWiki 1.14.0
[autoinstallsdev/mediawiki.git] / includes / specials / SpecialMostimages.php
1 <?php
2 /**
3  * @file
4  * @ingroup SpecialPage
5  *
6  * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
7  * @copyright Copyright © 2005, Ævar Arnfjörð Bjarmason
8  * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
9  */
10
11 /**
12  * implements Special:Mostimages
13  * @ingroup SpecialPage
14  */
15 class MostimagesPage extends ImageQueryPage {
16
17         function getName() { return 'Mostimages'; }
18         function isExpensive() { return true; }
19         function isSyndicated() { return false; }
20
21         function getSQL() {
22                 $dbr = wfGetDB( DB_SLAVE );
23                 $imagelinks = $dbr->tableName( 'imagelinks' );
24                 return
25                         "
26                         SELECT
27                                 'Mostimages' as type,
28                                 " . NS_FILE . " as namespace,
29                                 il_to as title,
30                                 COUNT(*) as value
31                         FROM $imagelinks
32                         GROUP BY il_to
33                         HAVING COUNT(*) > 1
34                         ";
35         }
36
37         function getCellHtml( $row ) {
38                 global $wgLang;
39                 return wfMsgExt( 'nlinks',  array( 'parsemag', 'escape' ),
40                         $wgLang->formatNum( $row->value ) ) . '<br />';
41         }
42
43 }
44
45 /**
46  * Constructor
47  */
48 function wfSpecialMostimages() {
49         list( $limit, $offset ) = wfCheckLimits();
50
51         $wpp = new MostimagesPage();
52
53         $wpp->doQuery( $offset, $limit );
54 }