* (bug 7684) Obey watchcreated preference for Special:Upload watch checkbox
[lhc/web/wiklou.git] / includes / SpecialMostimages.php
1 <?php
2 /**
3 * @package MediaWiki
4 * @subpackage 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 * @package MediaWiki
13 * @subpackage SpecialPage
14 */
15 class MostimagesPage extends QueryPage {
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 extract( $dbr->tableNames( 'imagelinks' ) );
24 return
25 "
26 SELECT
27 'Mostimages' as type,
28 " . NS_IMAGE . " as namespace,
29 il_to as title,
30 COUNT(*) as value
31 FROM $imagelinks
32 GROUP BY 1,2,3
33 HAVING COUNT(*) > 1
34 ";
35 }
36
37 function formatResult( $skin, $result ) {
38 global $wgLang, $wgContLang;
39
40 $nt = Title::makeTitle( $result->namespace, $result->title );
41 $text = $wgContLang->convert( $nt->getPrefixedText() );
42
43 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
44
45 $nl = wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
46 $wgLang->formatNum ( $result->value ) );
47 $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
48
49 return wfSpecialList($plink, $nlink);
50 }
51 }
52
53 /**
54 * Constructor
55 */
56 function wfSpecialMostimages() {
57 list( $limit, $offset ) = wfCheckLimits();
58
59 $wpp = new MostimagesPage();
60
61 $wpp->doQuery( $offset, $limit );
62 }
63
64 ?>