X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FBlock.php;h=c38c929fc5ab6bdf83f1af38d8e61f52c3140f89;hb=c6f0a3804dda31ae91cd5cadc1562d841d1fd2cb;hp=e23a8ff1432cfc919de6a1009dbf5d5bf4c84162;hpb=27c61fb1e94da9114314468fd00bcf129ec064b6;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Block.php b/includes/Block.php index e23a8ff143..c38c929fc5 100644 --- a/includes/Block.php +++ b/includes/Block.php @@ -224,7 +224,7 @@ class Block { 'ipb_address', 'ipb_by', 'ipb_by_text', - 'ipb_by_actor' => $wgActorTableSchemaMigrationStage > MIGRATION_OLD ? 'ipb_by_actor' : null, + 'ipb_by_actor' => $wgActorTableSchemaMigrationStage > MIGRATION_OLD ? 'ipb_by_actor' : 'NULL', 'ipb_timestamp', 'ipb_auto', 'ipb_anon_only', @@ -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 ); @@ -1137,15 +1134,18 @@ class Block { return; } - DeferredUpdates::addUpdate( new AtomicSectionUpdate( + DeferredUpdates::addUpdate( new AutoCommitUpdate( 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 ); + } } ) ); }