MediaWiki  1.33.0
SpecialUnusedimages.php
Go to the documentation of this file.
1 <?php
30  function __construct( $name = 'Unusedimages' ) {
31  parent::__construct( $name );
32  }
33 
34  function isExpensive() {
35  return true;
36  }
37 
38  function sortDescending() {
39  return false;
40  }
41 
42  function isSyndicated() {
43  return false;
44  }
45 
46  function getQueryInfo() {
47  $retval = [
48  'tables' => [ 'image', 'imagelinks' ],
49  'fields' => [
50  'namespace' => NS_FILE,
51  'title' => 'img_name',
52  'value' => 'img_timestamp',
53  ],
54  'conds' => [ 'il_to IS NULL' ],
55  'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
56  ];
57 
58  if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
59  // Order is significant
60  $retval['tables'] = [ 'image', 'page', 'categorylinks',
61  'imagelinks' ];
62  $retval['conds']['page_namespace'] = NS_FILE;
63  $retval['conds'][] = 'cl_from IS NULL';
64  $retval['conds'][] = 'img_name = page_title';
65  $retval['join_conds']['categorylinks'] = [
66  'LEFT JOIN', 'cl_from = page_id' ];
67  $retval['join_conds']['imagelinks'] = [
68  'LEFT JOIN', 'il_to = page_title' ];
69  }
70 
71  return $retval;
72  }
73 
74  function usesTimestamps() {
75  return true;
76  }
77 
78  function getPageHeader() {
79  if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
80  return $this->msg(
81  'unusedimagestext-categorizedimgisused'
82  )->parseAsBlock();
83  }
84  return $this->msg( 'unusedimagestext' )->parseAsBlock();
85  }
86 
87  protected function getGroupName() {
88  return 'maintenance';
89  }
90 }
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:796
UnusedimagesPage\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialUnusedimages.php:78
UnusedimagesPage\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialUnusedimages.php:42
NS_FILE
const NS_FILE
Definition: Defines.php:70
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
Definition: SpecialPage.php:764
UnusedimagesPage\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialUnusedimages.php:34
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
UnusedimagesPage\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialUnusedimages.php:38
UnusedimagesPage
A special page that lists unused images.
Definition: SpecialUnusedimages.php:29
UnusedimagesPage\usesTimestamps
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
Definition: SpecialUnusedimages.php:74
UnusedimagesPage\__construct
__construct( $name='Unusedimages')
Definition: SpecialUnusedimages.php:30
UnusedimagesPage\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialUnusedimages.php:87
ImageQueryPage
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
Definition: ImageQueryPage.php:34
UnusedimagesPage\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialUnusedimages.php:46