MediaWiki REL1_37
SpecialUnusedImages.php
Go to the documentation of this file.
1<?php
25
32
37 parent::__construct( 'Unusedimages' );
38 $this->setDBLoadBalancer( $loadBalancer );
39 }
40
41 public function isExpensive() {
42 return true;
43 }
44
45 protected function sortDescending() {
46 return false;
47 }
48
49 public function isSyndicated() {
50 return false;
51 }
52
53 public function getQueryInfo() {
54 $retval = [
55 'tables' => [ 'image', 'imagelinks' ],
56 'fields' => [
57 'namespace' => NS_FILE,
58 'title' => 'img_name',
59 'value' => 'img_timestamp',
60 ],
61 'conds' => [ 'il_to IS NULL' ],
62 'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
63 ];
64
65 if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
66 // Order is significant
67 $retval['tables'] = [ 'image', 'page', 'categorylinks',
68 'imagelinks' ];
69 $retval['conds']['page_namespace'] = NS_FILE;
70 $retval['conds'][] = 'cl_from IS NULL';
71 $retval['conds'][] = 'img_name = page_title';
72 $retval['join_conds']['categorylinks'] = [
73 'LEFT JOIN', 'cl_from = page_id' ];
74 $retval['join_conds']['imagelinks'] = [
75 'LEFT JOIN', 'il_to = page_title' ];
76 }
77
78 return $retval;
79 }
80
81 public function usesTimestamps() {
82 return true;
83 }
84
85 protected function getPageHeader() {
86 if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
87 return $this->msg(
88 'unusedimagestext-categorizedimgisused'
89 )->parseAsBlock();
90 }
91 return $this->msg( 'unusedimagestext' )->parseAsBlock();
92 }
93
94 protected function getGroupName() {
95 return 'maintenance';
96 }
97}
const NS_FILE
Definition Defines.php:70
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
setDBLoadBalancer(ILoadBalancer $loadBalancer)
ILoadBalancer null $loadBalancer
Definition QueryPage.php:71
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
A special page that lists unused images.
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
sortDescending()
Override to sort by increasing values.
getPageHeader()
The content returned by this function will be output before any result.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
isSyndicated()
Sometime we don't want to build rss / atom feeds.
__construct(ILoadBalancer $loadBalancer)
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Database cluster connection, tracking, load balancing, and transaction manager interface.