From: jenkins-bot Date: Wed, 28 Feb 2018 05:04:52 +0000 (+0000) Subject: Merge "Avoid use of deprecated SiteStatsUpdate::__construct()" X-Git-Tag: 1.31.0-rc.0~492 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=91088b419efaca19e7cec269417dd8536aefc5d5;hp=6a8fcf56aea76106ec7d033c42f887ebf8a84286;p=lhc%2Fweb%2Fwiklou.git Merge "Avoid use of deprecated SiteStatsUpdate::__construct()" --- diff --git a/includes/Block.php b/includes/Block.php index e23a8ff143..4e878d1045 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -539,10 +539,7 @@ class Block { $dbw = wfGetDB( DB_MASTER ); } - # Periodic purge via commit hooks - if ( mt_rand( 0, 9 ) == 0 ) { - self::purgeExpired(); - } + self::purgeExpired(); $row = $this->getDatabaseArray( $dbw ); @@ -1141,11 +1138,14 @@ class Block { 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 ); + } } ) ); }