It's a deferred update and the number of blocks are small
Change-Id: I75e0b7dc38b22f8aa7453582d535a8ab8121fd1a
$dbw = wfGetDB( DB_MASTER );
}
- # Periodic purge via commit hooks
- if ( mt_rand( 0, 9 ) == 0 ) {
- self::purgeExpired();
- }
+ self::purgeExpired();
$row = $this->getDatabaseArray( $dbw );
wfGetDB( DB_MASTER ),
__METHOD__,
function ( IDatabase $dbw, $fname ) {
- $dbw->delete(
- 'ipblocks',
+ $ids = $dbw->selectFieldValues( 'ipblocks',
+ 'ipb_id',
[ 'ipb_expiry < ' . $dbw->addQuotes( $dbw->timestamp() ) ],
$fname
);
+ if ( $ids ) {
+ $dbw->delete( 'ipblocks', [ 'ipb_id' => $ids ], $fname );
+ }
}
) );
}