/** * Clears the list of sites stored in the database. * * @see SiteStore::clear() * * @return bool Success */ public function clear() { $dbw = $this->dbLoadBalancer->getConnection(DB_MASTER); $dbw->startAtomic(__METHOD__); $ok = $dbw->delete('sites', '*', __METHOD__); $ok = $dbw->delete('site_identifiers', '*', __METHOD__) && $ok; $dbw->endAtomic(__METHOD__); $this->dbLoadBalancer->reuseConnection($dbw); $this->reset(); return $ok; }
/** * Clean up the connection when out of scope */ function __destruct() { if ($this->conn !== null) { $this->lb->reuseConnection($this->conn); } }
/** * @param DatabaseBase $connection * * @throws MWException */ private function reuseConnection($connection) { $this->loadBalancer->reuseConnection($connection); }