11use MediaWiki\Cache\LinkBatchFactory;
29 private int $migrationStage;
34 LinkBatchFactory $linkBatchFactory
36 parent::__construct(
'Wantedfiles' );
37 $this->repoGroup = $repoGroup;
47 # Specifically setting to use "Wanted Files" (NS_MAIN) as title, so as to get what
48 # category would be used on main namespace pages, for those tricky wikipedia
49 # admins who like to do {{#ifeq:{{NAMESPACE}}|foo|bar|....}}.
50 $catMessage = $this->
msg(
'broken-file-category' )
51 ->page( PageReferenceValue::localReference(
NS_MAIN,
"Wanted Files" ) )
52 ->inContentLanguage();
54 if ( !$catMessage->isDisabled() ) {
55 $category = Title::makeTitleSafe(
NS_CATEGORY, $catMessage->text() );
64 $noForeign =
'-noforeign';
69 ->msg(
'wantedfiletext-cat' . $noForeign )
70 ->params( $category->getFullText() )
74 ->msg(
'wantedfiletext-nocat' . $noForeign )
88 return $this->repoGroup->hasForeignRepos();
115 return (
bool)$this->repoGroup->findFile( $title );
121 $fileTable =
'image';
122 $nameField =
'img_name';
127 $nameField =
'file_name';
128 $extraConds1 = [
'img1.file_deleted' => 0 ];
129 $extraConds2 = [
'img2.file_deleted' => 0 ];
136 'img1' => $fileTable,
137 'img2' => $fileTable,
142 'value' =>
'COUNT(*)'
145 'img1.' . $nameField =>
null,
147 'img2.' . $nameField =>
null,
149 'options' => [
'GROUP BY' =>
'il_to' ],
151 'img1' => [
'LEFT JOIN',
152 array_merge( [
'il_to = img1.' . $nameField ], $extraConds1 ),
154 'page' => [
'LEFT JOIN', [
155 'il_to = page_title',
158 'redirect' => [
'LEFT JOIN', [
163 'img2' => [
'LEFT JOIN',
164 array_merge( [
'rd_title = img2.' . $nameField ], $extraConds2 ),
172 return 'maintenance';
180class_alias( SpecialWantedFiles::class,
'WantedFilesPage' );
const SCHEMA_COMPAT_READ_OLD
A class containing constants representing the names of configuration variables.
const FileSchemaMigrationStage
Name constant for the FileSchemaMigrationStage setting, for use with Config::get()
setDatabaseProvider(IConnectionProvider $databaseProvider)
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Base class for a "wanted" query page like WantedPages, WantedTemplates, etc.