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