From: onei Date: Sun, 6 Jul 2014 17:19:29 +0000 (+0200) Subject: Add delete link to Special:Listfiles X-Git-Tag: 1.31.0-rc.0~15048^2 X-Git-Url: http://git.cyclocoop.org/%24href?a=commitdiff_plain;h=17a79f1364303bbd8cae1218b89458ca5c3954b7;p=lhc%2Fweb%2Fwiklou.git Add delete link to Special:Listfiles The rationale is that the presence of a delete link can make combating image upload vandalism substantially easier. The change was originally added in https://github.com/Wikia/app/pull/3859 and is awaiting merger there. Change-Id: I94b1a2d551093a4ada7aede1ad5af2a23bf86308 --- diff --git a/includes/specials/SpecialListfiles.php b/includes/specials/SpecialListfiles.php index 3715b8b6e6..1faa0130ea 100644 --- a/includes/specials/SpecialListfiles.php +++ b/includes/specials/SpecialListfiles.php @@ -460,6 +460,19 @@ class ImageListPager extends TablePager { ); $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped(); + // Add delete links if allowed + // From https://github.com/Wikia/app/pull/3859 + if ( $filePage->userCan( 'delete', $this->getUser() ) ) { + $deleteMsg = $this->msg( 'listfiles-delete' )->escaped(); + + $delete = Linker::linkKnown( + $filePage, $deleteMsg, array(), array( 'action' => 'delete' ) + ); + $delete = $this->msg( 'parentheses' )->rawParams( $delete )->escaped(); + + return "$link $download $delete"; + } + return "$link $download"; } else { return htmlspecialchars( $value ); diff --git a/languages/i18n/en.json b/languages/i18n/en.json index 1be50b4807..d0e7ad3ebf 100644 --- a/languages/i18n/en.json +++ b/languages/i18n/en.json @@ -1417,6 +1417,7 @@ "license-nopreview": "(Preview not available)", "upload_source_url": "(a valid, publicly accessible URL)", "upload_source_file": "(a file on your computer)", + "listfiles-delete": "delete", "listfiles-summary": "This special page shows all uploaded files.", "listfiles_search_for": "Search for media name:", "imgfile": "file", diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json index a10ad5a4ce..78dd1fd570 100644 --- a/languages/i18n/qqq.json +++ b/languages/i18n/qqq.json @@ -1579,6 +1579,7 @@ "license-nopreview": "Error message when a certain license does not exist", "upload_source_url": "Used in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|Sourcefilename|label}}\n* {{msg-mw|Sourceurl|label}}\n* {{msg-mw|Upload source file}}\n* {{msg-mw|Upload-maxfilesize}}", "upload_source_file": "Used in [[Special:Upload]].\n\nSee also:\n* {{msg-mw|Sourcefilename|label}}\n* {{msg-mw|Sourceurl|label}}\n* {{msg-mw|Upload source url}}\n* {{msg-mw|Upload-maxfilesize}}", + "listfiles-delete": "Text of the delete links next to the entries on [[Special:ListFiles]], surrounded by parentheses.", "listfiles-summary": "This message is displayed at the top of [[Special:ImageList]] to explain how to use that special page.", "listfiles_search_for": "Input label for the form displayed on [[Special:ListFiles]].", "imgfile": "{{Identical|File}}",