This avoids master queries on HTTP GET. Filter out rows on the
fly and allow for pruning to only happen when blocks do.
Change-Id: Idd25b2f8a789ba191fde87e997910e78d67c7021
$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__ );
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 )