From 93730ea4a5dbee6bf93c081c336a3615cf9122da Mon Sep 17 00:00:00 2001 From: Tobias Date: Tue, 20 Apr 2010 20:30:11 +0000 Subject: [PATCH] When visiting a 'red link' of a deleted file, a deletion and move log excerpt is provided on the Upload form. --- RELEASE-NOTES | 2 ++ includes/specials/SpecialUpload.php | 15 +++++++++++++++ languages/messages/MessagesEn.php | 3 +++ 3 files changed, 20 insertions(+) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 04c06ba943..7d4b282a75 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -49,6 +49,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Special:Listfiles now supports a username parameter * Special:Random carries over query string parameters * (bug 23206) Add Special::Search hook for detecting successful "Go" +* When visiting a "red link" of a deleted file, a deletion and move log excerpt + is provided on the Upload form. === Bug fixes in 1.17 === * (bug 17560) Half-broken deletion moved image files to deletion archive diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index c87aceed51..fa113fff87 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -237,6 +237,21 @@ class SpecialUpload extends SpecialPage { $form->addPreText( wfMsgExt( 'session_fail_preview', 'parseinline' ) ); } + # Give a notice if the user is uploading a file that has been deleted or moved + # Note that this is independent from the message 'filewasdeleted' that requires JS + $desiredTitleObj = Title::newFromText( $this->mDesiredDestName, NS_FILE ); + $delNotice = ''; // empty by default + if ( !$desiredTitleObj->exists() ) { + LogEventsList::showLogExtract( &$delNotice, array( 'delete', 'move' ), + $desiredTitleObj->getPrefixedText(), + '', array( 'lim' => 10, + 'conds' => array( "log_action != 'revision'" ), + 'showIfEmpty' => false, + 'msgKey' => array( 'upload-recreate-warning' ) ) + ); + } + $form->addPreText( $delNotice ); + # Add text to form $form->addPreText( '
' . wfMsgExt( 'uploadtext', 'parse', array( $this->mDesiredDestName ) ) . diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index a9d700b4dc..5a277a4c54 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -2019,6 +2019,9 @@ Pages on [[Special:Watchlist|your watchlist]] are '''bold'''.", 'upload_directory_read_only' => 'The upload directory ($1) is not writable by the webserver.', 'uploaderror' => 'Upload error', 'upload-summary' => '', # do not translate or duplicate this message to other languages +'upload-recreate-warning' => "'''Warning: A file by that name has been deleted or moved.''' + +The deletion and move log for this page are provided here for convenience:", 'uploadtext' => "Use the form below to upload files. To view or search previously uploaded files go to the [[Special:FileList|list of uploaded files]], (re)uploads are also logged in the [[Special:Log/upload|upload log]], deletions in the [[Special:Log/delete|deletion log]]. -- 2.20.1