Alrighty, now we properly remove old blocks before inserting the new one. (Bug 10080...
authorChad Horohoe <demon@users.mediawiki.org>
Mon, 9 Jun 2008 22:03:29 +0000 (22:03 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Mon, 9 Jun 2008 22:03:29 +0000 (22:03 +0000)
includes/SpecialBlockip.php

index ec1fdd7..620fd80 100644 (file)
@@ -388,12 +388,11 @@ class IPBlockForm {
 
                if ( wfRunHooks('BlockIp', array(&$block, &$wgUser)) ) {
 
-                       if ( !$block->insert() ) {
-                               // Block already exists. Silently delete the existing block and insert it again
-                               $oldblock = Block::newFromDB( $this->BlockAddress );
-                               $oldblock->delete();
-                               $block->insert();
+                       if ( $oldblock = Block::newFromDB( $this->BlockAddress ) ) {
+                               $oldblock->delete(); // Block already exists. Silently delete it
                        }
+                       $block->insert();
+
 
                        wfRunHooks('BlockIpComplete', array($block, $wgUser));