Debian Codegraph @

includes/specials/SpecialMostImages.php

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