From af8314ba8492d28effbd931610341f5fd391c9b9 Mon Sep 17 00:00:00 2001 From: Daniel Kinzler Date: Fri, 2 Oct 2009 10:04:41 +0000 Subject: [PATCH] imageImport --check-userblock checks if the user used for importing was blocked --- maintenance/importImages.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 -- 2.20.1