MediaWiki  master
SpecialMostimages.php
Go to the documentation of this file.
1 <?php
29 
36 
40  public function __construct( $loadBalancer ) {
41  parent::__construct( is_string( $loadBalancer ) ? $loadBalancer : 'Mostimages' );
42  // This class is extended and therefor fallback to global state - T265307
43  if ( !$loadBalancer instanceof ILoadBalancer ) {
44  $loadBalancer = MediaWikiServices::getInstance()->getDBLoadBalancer();
45  }
46  $this->setDBLoadBalancer( $loadBalancer );
47  }
48 
49  public function isExpensive() {
50  return true;
51  }
52 
53  public function isSyndicated() {
54  return false;
55  }
56 
57  public function getQueryInfo() {
58  return [
59  'tables' => [ 'imagelinks' ],
60  'fields' => [
61  'namespace' => NS_FILE,
62  'title' => 'il_to',
63  'value' => 'COUNT(*)'
64  ],
65  'options' => [
66  'GROUP BY' => 'il_to',
67  'HAVING' => 'COUNT(*) > 1'
68  ]
69  ];
70  }
71 
72  protected function getCellHtml( $row ) {
73  return $this->msg( 'nimagelinks' )->numParams( $row->value )->escaped() . '<br />';
74  }
75 
76  protected function getGroupName() {
77  return 'highuse';
78  }
79 }
const NS_FILE
Definition: Defines.php:70
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
MediaWikiServices is the service locator for the application scope of MediaWiki.
A special page that lists most used images.
__construct( $loadBalancer)
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
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.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
setDBLoadBalancer(ILoadBalancer $loadBalancer)
Definition: QueryPage.php:895
ILoadBalancer null $loadBalancer
Definition: QueryPage.php:72
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Database cluster connection, tracking, load balancing, and transaction manager interface.