r40321 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40320‎ | r40321 | r40322 >
Date:23:08, 1 September 2008
Author:aaron
Status:old
Tags:
Comment:
Don't auto-override blocks (bug 15411)
Modified paths:
  • /trunk/extensions/CheckUser/CheckUser_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CheckUser/CheckUser_body.php
@@ -262,21 +262,25 @@
263263 0, // suppress name?
264264 0 // block from sending email?
265265 );
 266+ $oldblock = Block::newFromDB( $u->getName() );
 267+ /*
266268 // Kill old blocks, but leave range blocks
267 - $oldblock = Block::newFromDB( $u->getName() );
268269 if( $oldblock && $oldblock->mAddress == $u->getName() && $block->mRangeStart == $block->mRangeEnd ) {
269270 $oldblock->delete();
270271 }
271 - $block->insert();
272 - # Prepare log parameters
273 - $logParams = array();
274 - $logParams[] = $expirestr;
275 - if( $anonOnly ) {
276 - $logParams[] = 'anononly';
 272+ */
 273+ if( !$oldblock ) {
 274+ $block->insert();
 275+ # Prepare log parameters
 276+ $logParams = array();
 277+ $logParams[] = $expirestr;
 278+ if( $anonOnly ) {
 279+ $logParams[] = 'anononly';
 280+ }
 281+ $logParams[] = 'nocreate';
 282+ # Add log entry
 283+ $log->addEntry( 'block', $usertitle, $reason, $logParams );
277284 }
278 - $logParams[] = 'nocreate';
279 - # Add log entry
280 - $log->addEntry( 'block', $usertitle, $reason, $logParams );
281285 # Tag userpage! (check length to avoid mistakes)
282286 if( strlen($tag) > 2 ) {
283287 $userpage->doEdit( $tag, $reason, EDIT_MINOR );