From: Brian Wolff Date: Thu, 3 Jul 2014 07:25:49 +0000 (-0300) Subject: Change message on Special:Wantedfiles based on if foreign repo on. X-Git-Tag: 1.31.0-rc.0~15003^2 X-Git-Url: http://git.cyclocoop.org/%22.%24redirect_annul.%22?a=commitdiff_plain;h=0f4a61750ee42c987e3ec9c3987ad72150b23b2a;p=lhc%2Fweb%2Fwiklou.git Change message on Special:Wantedfiles based on if foreign repo on. 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 --- diff --git a/includes/specials/SpecialWantedfiles.php b/includes/specials/SpecialWantedfiles.php index fa68504b2a..edf4c43831 100644 --- a/includes/specials/SpecialWantedfiles.php +++ b/includes/specials/SpecialWantedfiles.php @@ -49,23 +49,44 @@ class WantedFilesPage extends WantedQueryPage { $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() { diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 1be50b4807..ba757b3a2e 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1599,7 +1599,9 @@ "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 struck out. 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 struck out.", + "wantedfiletext-nocat-noforeign": "The following files are used but do not exist.", "wantedtemplates": "Wanted templates", "wantedtemplates-summary": "", "mostlinked": "Most linked-to pages", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index a10ad5a4ce..ef742e826d 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1760,8 +1760,10 @@ "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}}",