MediaWiki fundraising/REL1_35
DBAccessBase.php
Go to the documentation of this file.
1<?php
2
6
35abstract class DBAccessBase implements IDBAccessObject {
37 private $lb;
38
40 protected $dbDomain = false;
41
47 public function __construct( $dbDomain = false ) {
48 $this->dbDomain = $dbDomain;
49 $this->lb = MediaWikiServices::getInstance()->getDBLoadBalancerFactory()
50 ->getMainLB( $dbDomain );
51 }
52
65 protected function getConnection( $id, array $groups = [] ) {
66 return $this->getLoadBalancer()->getConnectionRef( $id, $groups, $this->dbDomain );
67 }
68
79 protected function releaseConnection( IDatabase $db ) {
80 // no-op
81 }
82
92 protected function getLoadBalancer() {
93 return $this->lb;
94 }
95}
getLoadBalancer()
Get the database type used for read operations.
__construct( $dbDomain=false)
Stable to call.
string bool $dbDomain
The target wiki's DB domain.
getConnection( $id, array $groups=[])
Returns a database connection.
ILoadBalancer $lb
releaseConnection(IDatabase $db)
Releases a database connection and makes it available for recycling.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Interface for database access objects.
Basic database interface for live and lazy-loaded relation database handles.
Definition IDatabase.php:38
Database cluster connection, tracking, load balancing, and transaction manager interface.