Change-Id: I9f8c2576f511419e77e9b6f10c96a43e5d69704e
* @file
* @ingroup Maintenance
*/
+use \MediaWiki\MediaWikiServices;
+
class BatchRowWriter {
/**
* @var IDatabase $db The database to write to
* 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(
);
}
- $this->db->commit();
- wfGetLBFactory()->waitForReplication();
+ $lbFactory->commitAndWaitForReplication( __METHOD__, $ticket );
}
}