MediaWiki  1.28.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  'img_user', 'img_user_text',
54  'img_description'
55  ],
56  'conds' => [ 'il_to IS NULL' ],
57  'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
58  ];
59 
60  if ( $this->getConfig()->get( 'CountCategorizedImagesAsUsed' ) ) {
61  // Order is significant
62  $retval['tables'] = [ 'image', 'page', 'categorylinks',
63  'imagelinks' ];
64  $retval['conds']['page_namespace'] = NS_FILE;
65  $retval['conds'][] = 'cl_from IS NULL';
66  $retval['conds'][] = 'img_name = page_title';
67  $retval['join_conds']['categorylinks'] = [
68  'LEFT JOIN', 'cl_from = page_id' ];
69  $retval['join_conds']['imagelinks'] = [
70  'LEFT JOIN', 'il_to = page_title' ];
71  }
72 
73  return $retval;
74  }
75 
76  function usesTimestamps() {
77  return true;
78  }
79 
80  function getPageHeader() {
81  return $this->msg( 'unusedimagestext' )->parseAsBlock();
82  }
83 
84  protected function getGroupName() {
85  return 'maintenance';
86  }
87 }
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
msg()
Wrapper around wfMessage that sets the current context.
__construct($name= 'Unusedimages')
A special page that lists unused images.
const NS_FILE
Definition: Defines.php:62
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
getConfig()
Shortcut to get main config object.
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a local account incomplete not yet checked for validity & $retval
Definition: hooks.txt:242
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:300