Index: trunk/phase3/includes/SpecialUpload.php |
— | — | @@ -48,7 +48,7 @@ |
49 | 49 | return; |
50 | 50 | } |
51 | 51 | |
52 | | - $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning'); |
| 52 | + $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' ); |
53 | 53 | $this->mReUpload = $request->getCheck( 'wpReUpload' ); |
54 | 54 | $this->mUpload = $request->getCheck( 'wpUpload' ); |
55 | 55 | |
— | — | @@ -298,6 +298,16 @@ |
299 | 299 | $sk = $wgUser->getSkin(); |
300 | 300 | $dlink = $sk->makeKnownLinkObj( $nt ); |
301 | 301 | $warning .= '<li>'.wfMsgHtml( 'fileexists', $dlink ).'</li>'; |
| 302 | + } else { |
| 303 | + # If the file existed before and was deleted, warn the user of this |
| 304 | + # Don't bother doing so if the image exists now, however |
| 305 | + $image = new Image( $nt ); |
| 306 | + if( $image->wasDeleted() ) { |
| 307 | + $skin = $wgUser->getSkin(); |
| 308 | + $ltitle = Title::makeTitle( NS_SPECIAL, 'Log' ); |
| 309 | + $llink = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() ); |
| 310 | + $warning .= wfOpenElement( 'li' ) . wfMsgHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' ); |
| 311 | + } |
302 | 312 | } |
303 | 313 | |
304 | 314 | if( $warning != '' ) { |
Index: trunk/phase3/includes/Image.php |
— | — | @@ -1641,6 +1641,17 @@ |
1642 | 1642 | function isLocal() { |
1643 | 1643 | return !$this->fromSharedDirectory; |
1644 | 1644 | } |
| 1645 | + |
| 1646 | + /** |
| 1647 | + * Was this image ever deleted from the wiki? |
| 1648 | + * |
| 1649 | + * @return bool |
| 1650 | + */ |
| 1651 | + function wasDeleted() { |
| 1652 | + $dbw =& wfGetDB( DB_MASTER ); |
| 1653 | + $del = $dbw->selectField( 'archive', 'COUNT(*) AS count', array( 'ar_namespace' => NS_IMAGE, 'ar_title' => $this->title->getDBkey() ), 'Image::wasDeleted' ); |
| 1654 | + return $del > 0; |
| 1655 | + } |
1645 | 1656 | |
1646 | 1657 | } //class |
1647 | 1658 | |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -145,6 +145,7 @@ |
146 | 146 | * Rewrite reassignEdits script to be more efficient; support optional updates to |
147 | 147 | recent changes table; add reporting and silent modes |
148 | 148 | * Cleaned up formatNum usage in langfiles |
| 149 | +* (bug 5716) Warn when a user tries to upload a file which was previously deleted |
149 | 150 | |
150 | 151 | == Compatibility == |
151 | 152 | |
Index: trunk/phase3/languages/Messages.php |
— | — | @@ -864,6 +864,7 @@ |
865 | 865 | 'uploadvirus' => 'The file contains a virus! Details: $1', |
866 | 866 | 'sourcefilename' => 'Source filename', |
867 | 867 | 'destfilename' => 'Destination filename', |
| 868 | +'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.', |
868 | 869 | |
869 | 870 | 'license' => 'Licensing', |
870 | 871 | 'nolicense' => 'None selected', |