(bug 13803) Add 'reupload' parameter to allow reuploads of existing blacklisted images.

This commit is contained in:
Bryan Tong Minh 2008-04-20 21:21:16 +00:00
parent 59c13d77f8
commit b89489091c
2 changed files with 11 additions and 1 deletions

View file

@ -54,7 +54,11 @@ class TitleBlacklistHooks {
public static function verifyUpload( $fname, $fpath, &$err ) {
global $wgTitleBlacklist;
efInitTitleBlacklist();
$blacklisted = $wgTitleBlacklist->isBlacklisted( Title::newFromText( $fname, NS_IMAGE ), 'upload' );
$title = Title::newFromText( $fname, NS_IMAGE );
$action = $title->exists() ? 'reupload' : 'upload';
$blacklisted = $wgTitleBlacklist->isBlacklisted( $title, $action );
if( $blacklisted instanceof TitleBlacklistEntry ) {
wfLoadExtensionMessages( 'TitleBlacklist' );
$message = $blacklisted->getCustomMessage();

View file

@ -209,6 +209,9 @@ class TitleBlacklistEntry {
if( !isset( $this->mParams['noedit'] ) && $action == 'edit' ) {
return true;
}
if ( isset( $this->mParams['reupload'] ) && $action == 'reupload' ) {
return true;
}
return false;
}
return true;
@ -240,6 +243,9 @@ class TitleBlacklistEntry {
if( $opt2 == 'casesensitive' ) {
$options['casesensitive'] = true;
}
if( $opt2 == 'reupload' ) {
$options['reupload'] = true;
}
if( preg_match( '/errmsg\s*=\s*(.+)/i', $opt, $matches ) ) {
$options['errmsg'] = $matches[1];
}