X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Futils%2FBatchRowWriter.php;h=70afb91c1bca7813598fffa0b623517de2a10173;hb=09fcee61106146adbc8889f3950a2ea02cda0da6;hp=ffb7053b383f849435eeba510f5687ea72c5e175;hpb=4dc3ac1c375b3d2eb6172dfef8fdebe71b8c5f43;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/utils/BatchRowWriter.php b/includes/utils/BatchRowWriter.php index ffb7053b38..70afb91c1b 100644 --- a/includes/utils/BatchRowWriter.php +++ b/includes/utils/BatchRowWriter.php @@ -20,6 +20,9 @@ * @file * @ingroup Maintenance */ +use Wikimedia\Rdbms\IDatabase; +use \MediaWiki\MediaWikiServices; + class BatchRowWriter { /** * @var IDatabase $db The database to write to @@ -54,7 +57,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 +69,6 @@ class BatchRowWriter { ); } - $this->db->commit(); - wfGetLBFactory()->waitForReplication(); + $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket ); } }