Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 19
0.00% covered (danger)
0.00%
0 / 6
CRAP
0.00% covered (danger)
0.00%
0 / 1
SpecialMostImages
0.00% covered (danger)
0.00%
0 / 18
0.00% covered (danger)
0.00%
0 / 6
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 isExpensive
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 isSyndicated
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getQueryInfo
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
 getCellHtml
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 getGroupName
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Implements Special:Mostimages
4 *
5 * Copyright © 2005 Ævar Arnfjörð Bjarmason
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 * http://www.gnu.org/copyleft/gpl.html
21 *
22 * @file
23 * @ingroup SpecialPage
24 * @author Ævar Arnfjörð Bjarmason <avarab@gmail.com>
25 */
26
27namespace MediaWiki\Specials;
28
29use MediaWiki\SpecialPage\ImageQueryPage;
30use Wikimedia\Rdbms\IConnectionProvider;
31
32/**
33 * A special page that lists most used images
34 *
35 * @ingroup SpecialPage
36 */
37class SpecialMostImages extends ImageQueryPage {
38
39    /**
40     * @param IConnectionProvider $dbProvider
41     */
42    public function __construct( IConnectionProvider $dbProvider ) {
43        parent::__construct( 'Mostimages' );
44        $this->setDatabaseProvider( $dbProvider );
45    }
46
47    public function isExpensive() {
48        return true;
49    }
50
51    public function isSyndicated() {
52        return false;
53    }
54
55    public function getQueryInfo() {
56        return [
57            'tables' => [ 'imagelinks' ],
58            'fields' => [
59                'namespace' => NS_FILE,
60                'title' => 'il_to',
61                'value' => 'COUNT(*)'
62            ],
63            'options' => [
64                'GROUP BY' => 'il_to',
65                'HAVING' => 'COUNT(*) > 1'
66            ]
67        ];
68    }
69
70    protected function getCellHtml( $row ) {
71        return $this->msg( 'nimagelinks' )->numParams( $row->value )->escaped() . '<br />';
72    }
73
74    protected function getGroupName() {
75        return 'highuse';
76    }
77}
78
79/**
80 * Retain the old class name for backwards compatibility.
81 * @deprecated since 1.40
82 */
83class_alias( SpecialMostImages::class, 'MostimagesPage' );