The war on redundant ampersand usage!
[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 QueryPage {
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 formatResult( $skin, $result ) {
36 global $wgLang, $wgContLang;
37
38 $nt = Title::makeTitle( $result->namespace, $result->title );
39 $text = $wgContLang->convert( $nt->getPrefixedText() );
40
41 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
42
43 $nl = wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
44 $wgLang->formatNum ( $result->value ) );
45 $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
46
47 return wfSpecialList($plink, $nlink);
48 }
49 }
50
51 /**
52 * Constructor
53 */
54 function wfSpecialMostimages() {
55 list( $limit, $offset ) = wfCheckLimits();
56
57 $wpp = new MostimagesPage();
58
59 $wpp->doQuery( $offset, $limit );
60 }
61
62 ?>