Index: trunk/phase3/maintenance/importImages.php |
— | — | @@ -45,6 +45,14 @@ |
46 | 46 | $user = User::newFromName( 'Maintenance script' ); |
47 | 47 | $wgUser = $user; |
48 | 48 | |
| 49 | + # Get block check. If a value is given, this specified how often the check is performed |
| 50 | + if ( isset( $options['check-userblock'] ) ) { |
| 51 | + if ( !$options['check-userblock'] ) $checkUserBlock = 1; |
| 52 | + else $checkUserBlock = (int)$options['check-userblock']; |
| 53 | + } else { |
| 54 | + $checkUserBlock = false; |
| 55 | + } |
| 56 | + |
49 | 57 | # Get --from |
50 | 58 | $from = @$options['from']; |
51 | 59 | |
— | — | @@ -96,6 +104,14 @@ |
97 | 105 | } |
98 | 106 | } |
99 | 107 | |
| 108 | + if ( $checkUserBlock && ( ( $processed % $checkUserBlock ) == 0 ) ) { |
| 109 | + $user->clearInstanceCache( 'name' ); //reload from DB! |
| 110 | + if ( $user->isBlocked() ) { |
| 111 | + echo( $user->getName() . " was blocked! Aborting." ); |
| 112 | + break; |
| 113 | + } |
| 114 | + } |
| 115 | + |
100 | 116 | # Check existence |
101 | 117 | $image = wfLocalFile( $title ); |
102 | 118 | if( $image->exists() ) { |
— | — | @@ -239,6 +255,7 @@ |
240 | 256 | aborted imports. <name> should be the file's canonical database form. |
241 | 257 | --sleep=<sec> Sleep between files. Useful mostly for debugging. |
242 | 258 | --user=<username> Set username of uploader, default 'Maintenance script' |
| 259 | +--check-userblock Check if the user got blocked during import. |
243 | 260 | --comment=<text> Set upload summary comment, default 'Importing image file'. |
244 | 261 | --comment-file=<file> Set upload summary comment the the content of <file>. |
245 | 262 | --comment-ext=<ext> Causes the comment for each file to be loaded from a file with the same name |