Add replication-friendly background batch update mode.
[mediawiki.git] / includes / SpecialMostimages.php
blob17c07c70db3dd0379cbfe40a632dcec43adc43ba
1 <?php
2 /**
3 * @package MediaWiki
4 * @subpackage SpecialPage
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 */
11 /**
12 * @package MediaWiki
13 * @subpackage SpecialPage
15 class MostimagesPage extends QueryPage {
17 function getName() { return 'Mostimages'; }
18 function isExpensive() { return true; }
19 function isSyndicated() { return false; }
21 function getSQL() {
22 $dbr =& wfGetDB( DB_SLAVE );
23 $imagelinks = $dbr->tableName( 'imagelinks' );
24 return
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
37 function formatResult( $skin, $result ) {
38 global $wgLang, $wgContLang;
40 $nt = Title::makeTitle( $result->namespace, $result->title );
41 $text = $wgContLang->convert( $nt->getPrefixedText() );
43 $plink = $skin->makeKnownLink( $nt->getPrefixedText(), $text );
45 $nl = wfMsgExt( 'nlinks', array( 'parsemag', 'escape'),
46 $wgLang->formatNum ( $result->value ) );
47 $nlink = $skin->makeKnownLink( $nt->getPrefixedText() . '#filelinks', $nl );
49 return wfSpecialList($plink, $nlink);
53 /**
54 * Constructor
56 function wfSpecialMostimages() {
57 list( $limit, $offset ) = wfCheckLimits();
59 $wpp = new MostimagesPage();
61 $wpp->doQuery( $offset, $limit );