Merge "Move condition to not show form one level up"
[lhc/web/wiklou.git] / includes / utils / BatchRowWriter.php
index ffb7053..a6e47c8 100644 (file)
@@ -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 );
        }
 }