From: Aaron Schulz Date: Mon, 22 Aug 2016 03:03:17 +0000 (-0700) Subject: Use newer transaction methods in BatchRowWriter X-Git-Tag: 1.31.0-rc.0~5967^2 X-Git-Url: http://git.cyclocoop.org//%22%22.str_replace%28%27%22%27%2C?a=commitdiff_plain;h=2d4b19f774c3fcd773466e6849a737e519fe19ad;p=lhc%2Fweb%2Fwiklou.git Use newer transaction methods in BatchRowWriter Change-Id: I9f8c2576f511419e77e9b6f10c96a43e5d69704e --- 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 ); } }