From: Daniel Kinzler Date: Fri, 2 Oct 2009 10:04:41 +0000 (+0000) Subject: imageImport --check-userblock checks if the user used for importing was blocked X-Git-Tag: 1.31.0-rc.0~39412 X-Git-Url: http://git.cyclocoop.org//%22javascript:ModifierStyle%28%27%22.%24id.%22%27%29/%22?a=commitdiff_plain;h=af8314ba8492d28effbd931610341f5fd391c9b9;p=lhc%2Fweb%2Fwiklou.git imageImport --check-userblock checks if the user used for importing was blocked --- diff --git a/maintenance/importImages.php b/maintenance/importImages.php index ec5a16b36e..c41bfa650f 100644 --- a/maintenance/importImages.php +++ b/maintenance/importImages.php @@ -45,6 +45,14 @@ if (isset($options['protect']) && $options['protect'] == 1) $user = User::newFromName( 'Maintenance script' ); $wgUser = $user; + # Get block check. If a value is given, this specified how often the check is performed + if ( isset( $options['check-userblock'] ) ) { + if ( !$options['check-userblock'] ) $checkUserBlock = 1; + else $checkUserBlock = (int)$options['check-userblock']; + } else { + $checkUserBlock = false; + } + # Get --from $from = @$options['from']; @@ -96,6 +104,14 @@ if (isset($options['protect']) && $options['protect'] == 1) } } + if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) { + $user->clearInstanceCache( 'name' ); //reload from DB! + if ( $user->isBlocked() ) { + echo( $user->getName() . " was blocked! Aborting." ); + break; + } + } + # Check existence $image = wfLocalFile( $title ); if( $image->exists() ) { @@ -239,6 +255,7 @@ Options: aborted imports. should be the file's canonical database form. --sleep= Sleep between files. Useful mostly for debugging. --user= Set username of uploader, default 'Maintenance script' +--check-userblock Check if the user got blocked during import. --comment= Set upload summary comment, default 'Importing image file'. --comment-file= Set upload summary comment the the content of . --comment-ext= Causes the comment for each file to be loaded from a file with the same name