If foreign repos are off, no need to warn about false positives.
I mostly want this change for an upcoming change I'm making in
GlobalUsage - I660a61327cdb528
Change-Id: Ibcf63d48c50523722ce8384fa6b4b1f68524482c
$category = false;
}
+ $noForeign = '';
+ if ( !$this->likelyToHaveFalsePositives() ) {
+ // Additional messages for grep:
+ // wantedfiletext-cat-noforeign, wantedfiletext-nocat
+ $noForeign = '-noforeign';
+ }
+
if ( $category ) {
return $this
- ->msg( 'wantedfiletext-cat' )
+ ->msg( 'wantedfiletext-cat' . $noForeign )
->params( $category->getFullText() )
->parseAsBlock();
} else {
return $this
- ->msg( 'wantedfiletext-nocat' )
+ ->msg( 'wantedfiletext-nocat' . $noForeign )
->parseAsBlock();
}
}
+ /**
+ * Whether foreign repos are likely to cause false positives
+ *
+ * In its own function to allow subclasses to override.
+ * @see SpecialWantedFilesGUOverride in GlobalUsage extension.
+ * @since 1.24
+ */
+ protected function likelyToHaveFalsePositives() {
+ return RepoGroup::singleton()->hasForeignRepos();
+ }
+
/**
* KLUGE: The results may contain false positives for files
* that exist e.g. in a shared repo. Setting this at least
* keeps them from showing up as redlinks in the output, even
* if it doesn't fix the real problem (bug 6220).
+ *
+ * @note could also have existing links here from broken file
+ * redirects.
* @return bool
*/
function forceExistenceCheck() {
"wantedfiles": "Wanted files",
"wantedfiles-summary": "",
"wantedfiletext-cat": "The following files are used but do not exist. Files from foreign repositories may be listed despite existing. Any such false positives will be <del>struck out</del>. Additionally, pages that embed files that do not exist are listed in [[:$1]].",
+ "wantedfiletext-cat-noforeign": "The following files are used but do not exist. Additionally, pages that embed files that do not exist are listed in [[:$1]].",
"wantedfiletext-nocat": "The following files are used but do not exist. Files from foreign repositories may be listed despite existing. Any such false positives will be <del>struck out</del>.",
+ "wantedfiletext-nocat-noforeign": "The following files are used but do not exist.",
"wantedtemplates": "Wanted templates",
"wantedtemplates-summary": "",
"mostlinked": "Most linked-to pages",
"wantedpages-badtitle": "Error message shown when [[Special:WantedPages]] is listing a page with a title that shouldn't exist.\n\nParameters:\n* $1 - a page title",
"wantedfiles": "{{doc-special|WantedFiles}}",
"wantedfiles-summary": "{{doc-specialpagesummary|wantedfiles}}",
- "wantedfiletext-cat": "Message displayed at top of [[special:WantedFiles]]. $1 contains the name of the tracking category for broken files (Including Category prefix). {{msg-mw|wantedfiletext-nocat}} is used if the tracking category is disabled.",
- "wantedfiletext-nocat": "Message displayed at top of [[special:WantedFiles]] when broken file tracking category is disabled. See {{msg-mw|wantedfiletext-cat}}.",
+ "wantedfiletext-cat": "Message displayed at top of [[special:WantedFiles]] when false positives from foreign file repositories (like commons) are likely. $1 contains the name of the tracking category for broken files (Including Category prefix). {{msg-mw|wantedfiletext-nocat}} is used if the tracking category is disabled.\n\nSee also: {{msg-mw|wantedfiletext-cat-noforeign}}, {{msg-mw|wantedfiletext-nocat}}",
+ "wantedfiletext-cat-noforeign": "Message displayed at top of [[special:WantedFiles]] when the wiki has no foreign repositories. See also {{mwg-mw|wantedfilestext-cat}}. $1 contains the name of the tracking category for broken files (Including Category prefix). {{msg-mw|wantedfiletext-nocat}} is used if the tracking category is disabled.",
+ "wantedfiletext-nocat": "Message displayed at top of [[special:WantedFiles]] when broken file tracking category is disabled and false positives from foreign file repositories (like commons) are likely. See {{msg-mw|wantedfiletext-cat}}.",
+ "wantedfiletext-nocat-noforeign": "Message displayed at top of [[special:WantedFiles]] when broken file tracking category is disabled and their are no foreign file repositories enabled on the wiki. See {{msg-mw|wantedfiletext-cat}}, {{msg-mw|wantedfiletext-nocat}}.",
"wantedtemplates": "{{doc-special|WantedTemplates}}",
"wantedtemplates-summary": "{{doc-specialpagesummary|wantedtemplates}}",
"mostlinked": "{{doc-special|MostLinked}}",