* Rewrite reassignEdits script to be more efficient; support optional updates to
recent changes table; add reporting and silent modes
* Cleaned up formatNum usage in langfiles
+* (bug 5716) Warn when a user tries to upload a file which was previously deleted
== Compatibility ==
function isLocal() {
return !$this->fromSharedDirectory;
}
+
+ /**
+ * Was this image ever deleted from the wiki?
+ *
+ * @return bool
+ */
+ function wasDeleted() {
+ $dbw =& wfGetDB( DB_MASTER );
+ $del = $dbw->selectField( 'archive', 'COUNT(*) AS count', array( 'ar_namespace' => NS_IMAGE, 'ar_title' => $this->title->getDBkey() ), 'Image::wasDeleted' );
+ return $del > 0;
+ }
} //class
return;
}
- $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning');
+ $this->mIgnoreWarning = $request->getCheck( 'wpIgnoreWarning' );
$this->mReUpload = $request->getCheck( 'wpReUpload' );
$this->mUpload = $request->getCheck( 'wpUpload' );
$sk = $wgUser->getSkin();
$dlink = $sk->makeKnownLinkObj( $nt );
$warning .= '<li>'.wfMsgHtml( 'fileexists', $dlink ).'</li>';
+ } else {
+ # If the file existed before and was deleted, warn the user of this
+ # Don't bother doing so if the image exists now, however
+ $image = new Image( $nt );
+ if( $image->wasDeleted() ) {
+ $skin = $wgUser->getSkin();
+ $ltitle = Title::makeTitle( NS_SPECIAL, 'Log' );
+ $llink = $skin->makeKnownLinkObj( $ltitle, wfMsgHtml( 'deletionlog' ), 'type=delete&page=' . $nt->getPrefixedUrl() );
+ $warning .= wfOpenElement( 'li' ) . wfMsgHtml( 'filewasdeleted', $llink ) . wfCloseElement( 'li' );
+ }
}
if( $warning != '' ) {
'uploadvirus' => 'The file contains a virus! Details: $1',
'sourcefilename' => 'Source filename',
'destfilename' => 'Destination filename',
+'filewasdeleted' => 'A file of this name has been previously uploaded and subsequently deleted. You should check the $1 before proceeding to upload it again.',
'license' => 'Licensing',
'nolicense' => 'None selected',