wiki = $wiki; } /** * Returns a database connection. * * @see wfGetDB() * @see LoadBalancer::getConnection() * * @since 1.21 * * @param int $id Which connection to use * @param array $groups Query groups * * @return IDatabase */ protected function getConnection( $id, $groups = [] ) { $loadBalancer = wfGetLB( $this->wiki ); return $loadBalancer->getConnection( $id, $groups, $this->wiki ); } /** * Releases a database connection and makes it available for recycling. * * @see LoadBalancer::reuseConnection() * * @since 1.21 * * @param IDatabase $db The database connection to release. */ protected function releaseConnection( IDatabase $db ) { if ( $this->wiki !== false ) { $loadBalancer = $this->getLoadBalancer(); $loadBalancer->reuseConnection( $db ); } } /** * Get the database type used for read operations. * * @see wfGetLB * * @since 1.21 * * @return LoadBalancer The database load balancer object */ public function getLoadBalancer() { return wfGetLB( $this->wiki ); } }