r90329 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90328‎ | r90329 | r90330 >
Date:00:29, 18 June 2011
Author:aaron
Status:ok
Tags:
Comment:
Tweaked comments and code in confusing spot of doAutoblock()
Modified paths:
  • /trunk/phase3/includes/Block.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/Block.php
@@ -579,35 +579,35 @@
580580 return false;
581581 }
582582
583 - # Check for presence on the autoblock whitelist
 583+ # Check for presence on the autoblock whitelist.
584584 if ( self::isWhitelistedFromAutoblocks( $autoblockIP ) ) {
585585 return false;
586586 }
587587
588 - # # Allow hooks to cancel the autoblock.
 588+ # Allow hooks to cancel the autoblock.
589589 if ( !wfRunHooks( 'AbortAutoblock', array( $autoblockIP, &$this ) ) ) {
590590 wfDebug( "Autoblock aborted by hook.\n" );
591591 return false;
592592 }
593593
594 - # It's okay to autoblock. Go ahead and create/insert the block.
 594+ # It's okay to autoblock. Go ahead and insert/update the block...
595595
 596+ # Do not add a *new* block if the IP is already blocked.
596597 $ipblock = Block::newFromTarget( $autoblockIP );
597598 if ( $ipblock ) {
598 - # If the user is already blocked. Then check if the autoblock would
599 - # exceed the user block. If it would exceed, then do nothing, else
600 - # prolong block time
601 - if ( $this->mExpiry > Block::getAutoblockExpiry( $ipblock->mTimestamp )
 599+ # Check if the block is an autoblock and would exceed the user block
 600+ # if renewed. If so, do nothing, otherwise prolong the block time...
 601+ if ( $ipblock->mAuto && // @TODO: why not compare $ipblock->mExpiry?
 602+ $this->mExpiry > Block::getAutoblockExpiry( $ipblock->mTimestamp )
602603 ) {
603 - # If the block is an autoblock, reset its timestamp to now and its expiry
604 - # to an $wgAutoblockExpiry in the future; otherwise do nothing
 604+ # Reset block timestamp to now and its expiry to
 605+ # $wgAutoblockExpiry in the future
605606 $ipblock->updateTimestamp();
606607 }
607608 return false;
608 -
609609 }
610610
611 - # Make a new block object with the desired properties
 611+ # Make a new block object with the desired properties.
612612 $autoblock = new Block;
613613 wfDebug( "Autoblocking {$this->getTarget()}@" . $autoblockIP . "\n" );
614614 $autoblock->setTarget( $autoblockIP );
@@ -630,7 +630,7 @@
631631 $autoblock->mExpiry = min( $this->mExpiry, Block::getAutoblockExpiry( wfTimestampNow() ) );
632632 }
633633
634 - # Insert it
 634+ # Insert the block...
635635 $status = $autoblock->insert();
636636 return $status
637637 ? $status['id']

Status & tagging log