Movatterモバイル変換


[0]ホーム

URL:


MediaWiki master
SpecialUnusedImages.php
Go to the documentation of this file.
1<?php
7namespaceMediaWiki\Specials;
8
9useMediaWiki\MainConfigNames;
10useMediaWiki\MediaWikiServices;
11useMediaWiki\SpecialPage\ImageQueryPage;
12useWikimedia\Rdbms\IConnectionProvider;
13
19classSpecialUnusedImagesextendsImageQueryPage {
20privateint $migrationStage;
21
22publicfunction__construct(IConnectionProvider $dbProvider ) {
23 parent::__construct('Unusedimages' );
24 $this->setDatabaseProvider( $dbProvider );
25 $this->migrationStage =MediaWikiServices::getInstance()->getMainConfig()->get(
27 );
28 }
29
31publicfunctionisExpensive() {
32returntrue;
33 }
34
36protectedfunctionsortDescending() {
37returnfalse;
38 }
39
41publicfunctionisSyndicated() {
42returnfalse;
43 }
44
46publicfunctiongetQueryInfo() {
47if ( $this->migrationStage &SCHEMA_COMPAT_READ_OLD ) {
48 $tables = ['image' ];
49 $nameField ='img_name';
50 $timestampField ='img_timestamp';
51 $extraConds = [];
52 $extraJoins = [];
53 }else {
54 $tables = ['file','filerevision' ];
55 $nameField ='file_name';
56 $timestampField ='fr_timestamp';
57 $extraConds = ['file_deleted' => 0 ];
58 $extraJoins = ['filerevision' => ['JOIN','file_latest = fr_id' ] ];
59 }
60
61 $retval = [
62'tables' => array_merge( $tables, ['imagelinks' ] ),
63'fields' => [
64'namespace' =>NS_FILE,
65'title' => $nameField,
66'value' => $timestampField,
67 ],
68'conds' => array_merge( ['il_to' =>null ], $extraConds ),
69'join_conds' => array_merge(
70 ['imagelinks' => ['LEFT JOIN','il_to = ' . $nameField ] ],
71 $extraJoins
72 ),
73 ];
74
76// Order is significant
77 $retval['tables'] = ['image','page','categorylinks',
78'imagelinks' ];
79 $retval['conds']['page_namespace'] =NS_FILE;
80 $retval['conds']['cl_from'] =null;
81 $retval['conds'][] = $nameField .' = page_title';
82 $retval['join_conds']['categorylinks'] = [
83'LEFT JOIN','cl_from = page_id' ];
84 $retval['join_conds']['imagelinks'] = [
85'LEFT JOIN','il_to = page_title' ];
86 }
87
88return $retval;
89 }
90
92publicfunctionusesTimestamps() {
93returntrue;
94 }
95
97protectedfunctiongetPageHeader() {
99return $this->msg(
100'unusedimagestext-categorizedimgisused'
101 )->parseAsBlock();
102 }
103return $this->msg('unusedimagestext' )->parseAsBlock();
104 }
105
107protectedfunctiongetGroupName() {
108return'maintenance';
109 }
110}
111
116class_alias( SpecialUnusedImages::class,'SpecialUnusedImages' );
NS_FILE
const NS_FILE
DefinitionDefines.php:57
SCHEMA_COMPAT_READ_OLD
const SCHEMA_COMPAT_READ_OLD
DefinitionDefines.php:294
MediaWiki\MainConfigNames
A class containing constants representing the names of configuration variables.
DefinitionMainConfigNames.php:22
MediaWiki\MainConfigNames\CountCategorizedImagesAsUsed
const CountCategorizedImagesAsUsed
Name constant for the CountCategorizedImagesAsUsed setting, for use with Config::get()
DefinitionMainConfigNames.php:4152
MediaWiki\MainConfigNames\FileSchemaMigrationStage
const FileSchemaMigrationStage
Name constant for the FileSchemaMigrationStage setting, for use with Config::get()
DefinitionMainConfigNames.php:1260
MediaWiki\MediaWikiServices
Service locator for MediaWiki core services.
DefinitionMediaWikiServices.php:256
MediaWiki\MediaWikiServices\getInstance
static getInstance()
Returns the global default instance of the top level service locator.
DefinitionMediaWikiServices.php:344
MediaWiki\SpecialPage\ImageQueryPage
Variant of QueryPage which uses a gallery to output results, thus suited for reports generating image...
DefinitionImageQueryPage.php:29
MediaWiki\SpecialPage\QueryPage\setDatabaseProvider
setDatabaseProvider(IConnectionProvider $databaseProvider)
DefinitionQueryPage.php:1050
MediaWiki\SpecialPage\SpecialPage\getConfig
getConfig()
Shortcut to get main config object.
DefinitionSpecialPage.php:949
MediaWiki\SpecialPage\SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
DefinitionSpecialPage.php:985
MediaWiki\Specials\SpecialUnusedImages
List of unused images.
DefinitionSpecialUnusedImages.php:19
MediaWiki\Specials\SpecialUnusedImages\isSyndicated
isSyndicated()
Sometimes we don't want to build rss / atom feeds.to override bool
DefinitionSpecialUnusedImages.php:41
MediaWiki\Specials\SpecialUnusedImages\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.to override string
DefinitionSpecialUnusedImages.php:97
MediaWiki\Specials\SpecialUnusedImages\isExpensive
isExpensive()
Should this query page only be updated offline on large wikis?If the query for this page is considere...
DefinitionSpecialUnusedImages.php:31
MediaWiki\Specials\SpecialUnusedImages\usesTimestamps
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
DefinitionSpecialUnusedImages.php:92
MediaWiki\Specials\SpecialUnusedImages\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
DefinitionSpecialUnusedImages.php:107
MediaWiki\Specials\SpecialUnusedImages\__construct
__construct(IConnectionProvider $dbProvider)
DefinitionSpecialUnusedImages.php:22
MediaWiki\Specials\SpecialUnusedImages\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
DefinitionSpecialUnusedImages.php:46
MediaWiki\Specials\SpecialUnusedImages\sortDescending
sortDescending()
Override to sort by increasing values.to override bool
DefinitionSpecialUnusedImages.php:36
Wikimedia\Rdbms\IConnectionProvider
Provide primary and replica IDatabase connections.
DefinitionIConnectionProvider.php:21
MediaWiki\Specials

[8]ページ先頭

©2009-2025 Movatter.jp