Do not reveal RevDeled file title
authorBrad Jorsch <bjorsch@wikimedia.org>
Tue, 31 Dec 2013 14:24:13 +0000 (09:24 -0500)
committerBrad Jorsch <bjorsch@wikimedia.org>
Fri, 3 Jan 2014 17:40:26 +0000 (12:40 -0500)
When an file is being uploaded, we tell the user if it has been
uploaded and deleted in the past. But we shouldn't reveal the title
under which that was done if the file was suppressed via RevDel.

Note this introduces a breaking API change: clients may now receive a
"deleted-archive" warning with an empty value if the title was
suppressed.

Bug: 59167
Change-Id: I01a3ac2ba0cbac6b28de26a7f1a1d09b6b02097e

includes/specials/SpecialUpload.php
includes/upload/UploadBase.php
languages/messages/MessagesEn.php
languages/messages/MessagesQqq.php
maintenance/language/messages.inc

index 5175ec9..27ba78e 100644 (file)
@@ -348,9 +348,14 @@ class SpecialUpload extends SpecialPage {
                        } elseif ( $warning == 'duplicate' ) {
                                $msg = $this->getDupeWarning( $args );
                        } elseif ( $warning == 'duplicate-archive' ) {
-                               $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
-                                               Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
-                                       . "</li>\n";
+                               if ( $args === '' ) {
+                                       $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate-notitle' )->parse()
+                                               . "</li>\n";
+                               } else {
+                                       $msg = "\t<li>" . $this->msg( 'file-deleted-duplicate',
+                                                       Title::makeTitle( NS_FILE, $args )->getPrefixedText() )->parse()
+                                               . "</li>\n";
+                               }
                        } else {
                                if ( $args === true ) {
                                        $args = array();
index 9f34f9c..4c8148a 100644 (file)
@@ -655,7 +655,11 @@ abstract class UploadBase {
                // Check dupes against archives
                $archivedImage = new ArchivedFile( null, 0, "{$hash}.{$this->mFinalExtension}" );
                if ( $archivedImage->getID() > 0 ) {
-                       $warnings['duplicate-archive'] = $archivedImage->getName();
+                       if ( $archivedImage->userCan( File::DELETED_FILE ) ) {
+                               $warnings['duplicate-archive'] = $archivedImage->getName();
+                       } else {
+                               $warnings['duplicate-archive'] = '';
+                       }
                }
 
                wfProfileOut( __METHOD__ );
index 30c41e5..e27ed07 100644 (file)
@@ -2327,6 +2327,8 @@ If you still want to upload your file, please go back and use a new name.
 'file-exists-duplicate'       => 'This file is a duplicate of the following {{PLURAL:$1|file|files}}:',
 'file-deleted-duplicate'      => "A file identical to this file ([[:$1]]) has previously been deleted.
 You should check that file's deletion history before proceeding to re-upload it.",
+'file-deleted-duplicate-notitle' => "A file identical to this file has previously been deleted, and the title has been suppressed.
+You should ask someone with the ability to view suppressed file data to review the situation before proceeding to re-upload it.",
 'uploadwarning'               => 'Upload warning',
 'uploadwarning-text'          => 'Please modify the file description below and try again.',
 'savefile'                    => 'Save file',
index 295fb33..4f8608a 100644 (file)
@@ -4041,7 +4041,14 @@ This message is followed by the gallery of the duplicate files.
 Parameters:
 * $1 - number of duplicate files',
 'file-deleted-duplicate' => 'Used in [[Special:Upload]. Parameters:
-* $1 - page title of the file',
+* $1 - page title of the file
+
+See also:
+* {{msg-mw|file-deleted-duplicate-notitle}}',
+'file-deleted-duplicate-notitle' => 'Used in [[Special:Upload] when the title of the deleted duplicate is not available.
+
+See also:
+* {{msg-mw|file-deleted-duplicate}}',
 'uploadwarning' => 'Used as section header in [[Special:Upload]].',
 'uploadwarning-text' => 'Used in [[Special:Upload]].',
 'savefile' => 'When uploading a file',
index b6af033..ca0519a 100644 (file)
@@ -1414,6 +1414,7 @@ $wgMessageStructure = array(
                'fileexists-shared-forbidden',
                'file-exists-duplicate',
                'file-deleted-duplicate',
+               'file-deleted-duplicate-notitle',
                'uploadwarning',
                'uploadwarning-text',
                'savefile',