/** * Get a master connection to the logging DB * * @return IDatabase * @throws DBError */ protected function getMasterDB() { if (!$this->dbw) { // Get a separate connection in autocommit mode $lb = wfGetLBFactory()->newMainLB(); $this->dbw = $lb->getConnection(DB_MASTER, array(), $this->wiki); $this->dbw->clearFlag(DBO_TRX); } return $this->dbw; }
public function doUpdate() { if (!$this->callback) { return; } $autoTrx = $this->dbw->getFlag(DBO_TRX); $this->dbw->clearFlag(DBO_TRX); try { /** @var Exception $e */ $e = null; call_user_func_array($this->callback, [$this->dbw, $this->fname]); } catch (Exception $e) { } if ($autoTrx) { $this->dbw->setFlag(DBO_TRX); } if ($e) { throw $e; } }