X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Futils%2FBatchRowWriter.php;h=a6e47c89764a52da65a1c117a5f5dfcdb330b702;hb=4518a5a86ce81faff53407d4603b8643144a9d33;hp=ffb7053b383f849435eeba510f5687ea72c5e175;hpb=e2a7988178698b4369c7963d20610ee622db3ee7;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/utils/BatchRowWriter.php b/includes/utils/BatchRowWriter.php index ffb7053b38..a6e47c8976 100644 --- a/includes/utils/BatchRowWriter.php +++ b/includes/utils/BatchRowWriter.php @@ -20,6 +20,8 @@ * @file * @ingroup Maintenance */ +use \MediaWiki\MediaWikiServices; + class BatchRowWriter { /** * @var IDatabase $db The database to write to @@ -54,7 +56,8 @@ class BatchRowWriter { * names to update values to apply to the row. */ public function write( array $updates ) { - $this->db->begin(); + $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); + $ticket = $lbFactory->getEmptyTransactionTicket( __METHOD__ ); foreach ( $updates as $update ) { $this->db->update( @@ -65,7 +68,6 @@ class BatchRowWriter { ); } - $this->db->commit(); - wfGetLBFactory()->waitForReplication(); + $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); } }