MediaWiki master
SpecialMostImages.php
Go to the documentation of this file.
1<?php
9namespace MediaWiki\Specials;
10
14
22
23 public function __construct( IConnectionProvider $dbProvider ) {
24 parent::__construct( 'Mostimages' );
25 $this->setDatabaseProvider( $dbProvider );
26 }
27
29 public function isExpensive() {
30 return true;
31 }
32
34 public function isSyndicated() {
35 return false;
36 }
37
39 public function getQueryInfo() {
40 return [
41 'tables' => [ 'imagelinks', 'linktarget' ],
42 'fields' => [
43 'namespace' => NS_FILE,
44 'title' => 'lt_title',
45 'value' => 'COUNT(*)'
46 ],
47 'join_conds' => [ 'linktarget' => [ 'JOIN', 'il_target_id = lt_id' ] ],
48 'options' => [
49 'GROUP BY' => 'lt_title',
50 'HAVING' => 'COUNT(*) > 1'
51 ]
52 ];
53 }
54
56 protected function getCellHtml( $row ) {
57 return $this->msg( 'nimagelinks' )->numParams( $row->value )->escaped() . '<br />';
58 }
59
61 protected function getGroupName() {
62 return 'highuse';
63 }
64
66 protected function getRecacheDB() {
67 return $this->getDatabaseProvider()->getReplicaDatabase(
68 ImageLinksTable::VIRTUAL_DOMAIN,
69 'vslow'
70 );
71 }
72}
73
78class_alias( SpecialMostImages::class, 'MostimagesPage' );
const NS_FILE
Definition Defines.php:57
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
setDatabaseProvider(IConnectionProvider $databaseProvider)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
List of the most used images.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getCellHtml( $row)
Get additional HTML to be shown in a results' cell.to overridestring
getRecacheDB()
Get a DB connection to be used for slow recache queries.to override IReadableDatabase
isExpensive()
Should this query page only be updated offline on large wikis?If the query for this page is considere...
__construct(IConnectionProvider $dbProvider)
isSyndicated()
Sometimes we don't want to build rss / atom feeds.to override bool
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Provide primary and replica IDatabase connections.