Merge "Remove Block::purgeExpired() call from block query API"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Mon, 29 Aug 2016 16:30:15 +0000 (16:30 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Mon, 29 Aug 2016 16:30:15 +0000 (16:30 +0000)
includes/api/ApiQueryBlocks.php
includes/specials/SpecialBlockList.php

index 8b8bd01..5d7c664 100644 (file)
@@ -173,10 +173,8 @@ class ApiQueryBlocks extends ApiQueryBase {
                        $this->addWhereFld( 'ipb_deleted', 0 );
                }
 
-               // Purge expired entries on one in every 10 queries
-               if ( !mt_rand( 0, 10 ) ) {
-                       Block::purgeExpired();
-               }
+               # Filter out expired rows
+               $this->addWhere( 'ipb_expiry > ' . $db->addQuotes( $db->timestamp() ) );
 
                $res = $this->select( __METHOD__ );
 
index 7c7f017..de58762 100644 (file)
@@ -136,8 +136,7 @@ class SpecialBlockList extends SpecialPage {
                                case Block::TYPE_IP:
                                case Block::TYPE_RANGE:
                                        list( $start, $end ) = IP::parseRange( $target );
-                                       $dbr = wfGetDB( DB_SLAVE );
-                                       $conds[] = $dbr->makeList(
+                                       $conds[] = wfGetDB( DB_SLAVE )->makeList(
                                                [
                                                        'ipb_address' => $target,
                                                        Block::getRangeCond( $start, $end )