Avoid calling Block::deleteIfExpired() when not needed
authorAaron Schulz <aschulz@wikimedia.org>
Wed, 30 Dec 2015 04:29:10 +0000 (20:29 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Wed, 30 Dec 2015 04:29:10 +0000 (20:29 -0800)
Just ignore the block and let the block insert/update code
handle the logic of pruning expired conflicting blocks as
well as other expired block to other users (as is done
already).

Bug: T92357
Change-Id: Iafcae829af09ed7e8d134cd6c1b2d5bd57ea0f22

includes/Block.php

index 4729f50..7b287dc 100644 (file)
@@ -296,7 +296,7 @@ class Block {
                        $block = self::newFromRow( $row );
 
                        # Don't use expired blocks
-                       if ( $block->deleteIfExpired() ) {
+                       if ( $block->isExpired() ) {
                                continue;
                        }
 
@@ -1140,7 +1140,7 @@ class Block {
                $blocks = array();
                foreach ( $rows as $row ) {
                        $block = self::newFromRow( $row );
-                       if ( !$block->deleteIfExpired() ) {
+                       if ( !$block->isExpired() ) {
                                $blocks[] = $block;
                        }
                }