* Split most of the result output code from QueryPage::doQuery() into QueryPage:...
[lhc/web/wiklou.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 * @addtogroup SpecialPage
12 */
13 class MostimagesPage extends ImageQueryPage {
14
15 function getName() { return 'Mostimages'; }
16 function isExpensive() { return true; }
17 function isSyndicated() { return false; }
18
19 function getSQL() {
20 $dbr = wfGetDB( DB_SLAVE );
21 $imagelinks = $dbr->tableName( 'imagelinks' );
22 return
23 "
24 SELECT
25 'Mostimages' as type,
26 " . NS_IMAGE . " as namespace,
27 il_to as title,
28 COUNT(*) as value
29 FROM $imagelinks
30 GROUP BY 1,2,3
31 HAVING COUNT(*) > 1
32 ";
33 }
34
35 function getCellHtml( $row ) {
36 global $wgLang;
37 return wfMsgExt( 'nlinks', array( 'parsemag', 'escape' ),
38 $wgLang->formatNum( $row->value ) ) . '<br />';
39 }
40
41 }
42
43 /**
44 * Constructor
45 */
46 function wfSpecialMostimages() {
47 list( $limit, $offset ) = wfCheckLimits();
48
49 $wpp = new MostimagesPage();
50
51 $wpp->doQuery( $offset, $limit );
52 }
53
54 ?>