mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/TitleBlacklist
synced 2024-11-15 10:17:49 +00:00
(bug 13803) Add 'reupload' parameter to allow reuploads of existing blacklisted images.
This commit is contained in:
parent
59c13d77f8
commit
b89489091c
|
@ -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();
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue