MediaWiki master
SpecialUnusedImages.php
Go to the documentation of this file.
1<?php
24namespace MediaWiki\Specials;
25
29
36
40 public function __construct( IConnectionProvider $dbProvider ) {
41 parent::__construct( 'Unusedimages' );
42 $this->setDatabaseProvider( $dbProvider );
43 }
44
45 public function isExpensive() {
46 return true;
47 }
48
49 protected function sortDescending() {
50 return false;
51 }
52
53 public function isSyndicated() {
54 return false;
55 }
56
57 public function getQueryInfo() {
58 $retval = [
59 'tables' => [ 'image', 'imagelinks' ],
60 'fields' => [
61 'namespace' => NS_FILE,
62 'title' => 'img_name',
63 'value' => 'img_timestamp',
64 ],
65 'conds' => [ 'il_to' => null ],
66 'join_conds' => [ 'imagelinks' => [ 'LEFT JOIN', 'il_to = img_name' ] ]
67 ];
68
70 // Order is significant
71 $retval['tables'] = [ 'image', 'page', 'categorylinks',
72 'imagelinks' ];
73 $retval['conds']['page_namespace'] = NS_FILE;
74 $retval['conds']['cl_from'] = null;
75 $retval['conds'][] = 'img_name = page_title';
76 $retval['join_conds']['categorylinks'] = [
77 'LEFT JOIN', 'cl_from = page_id' ];
78 $retval['join_conds']['imagelinks'] = [
79 'LEFT JOIN', 'il_to = page_title' ];
80 }
81
82 return $retval;
83 }
84
85 public function usesTimestamps() {
86 return true;
87 }
88
89 protected function getPageHeader() {
91 return $this->msg(
92 'unusedimagestext-categorizedimgisused'
93 )->parseAsBlock();
94 }
95 return $this->msg( 'unusedimagestext' )->parseAsBlock();
96 }
97
98 protected function getGroupName() {
99 return 'maintenance';
100 }
101}
102
107class_alias( SpecialUnusedImages::class, 'SpecialUnusedImages' );
const NS_FILE
Definition Defines.php:70
A class containing constants representing the names of configuration variables.
const CountCategorizedImagesAsUsed
Name constant for the CountCategorizedImagesAsUsed setting, for use with Config::get()
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
setDatabaseProvider(IConnectionProvider $databaseProvider)
getConfig()
Shortcut to get main config object.
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
A special page that lists unused images.
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
getPageHeader()
The content returned by this function will be output before any result.
isExpensive()
Should this query page only be updated offline on large wikis?
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
__construct(IConnectionProvider $dbProvider)
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
sortDescending()
Override to sort by increasing values.
Provide primary and replica IDatabase connections.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...