MediaWiki master
Wikimedia\Rdbms\ConnectionManager Class Reference

Database connection manager. More...

Inherited by Wikimedia\Rdbms\SessionConsistentConnectionManager.

Public Member Functions

 __construct (ILoadBalancer $loadBalancer, $domain=false, array $groups=[])
 
 getReadConnection (?array $groups=null, int $flags=0)
 Returns a database connection for reading.
 
 getWriteConnection (int $flags=0)
 Returns a connection to the primary DB, for updating.
 

Detailed Description

Database connection manager.

This manages access to primary and replica databases.

Since
1.29
Author
Addshore

Definition at line 33 of file ConnectionManager.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\Rdbms\ConnectionManager::__construct ( ILoadBalancer  $loadBalancer,
  $domain = false,
array  $groups = [] 
)
Parameters
ILoadBalancer$loadBalancer
string | false$domainOptional logical DB name, defaults to current wiki. This follows the convention for database names used by $loadBalancer.
string[]$groupssee LoadBalancer::getConnection
Exceptions
InvalidArgumentException

Definition at line 60 of file ConnectionManager.php.

Member Function Documentation

◆ getReadConnection()

Wikimedia\Rdbms\ConnectionManager::getReadConnection ( ?array  $groups = null,
int  $flags = 0 
)

Returns a database connection for reading.

Since
1.29
1.37 Added optional $flags parameter
Parameters
string[] | null$groups
int$flags
Returns
IReadableDatabase

Reimplemented in Wikimedia\Rdbms\SessionConsistentConnectionManager.

Definition at line 102 of file ConnectionManager.php.

References DB_REPLICA.

◆ getWriteConnection()

Wikimedia\Rdbms\ConnectionManager::getWriteConnection ( int  $flags = 0)

Returns a connection to the primary DB, for updating.

Since
1.29
1.37 Added optional $flags parameter
Parameters
int$flags
Returns
IDatabase

Reimplemented in Wikimedia\Rdbms\SessionConsistentConnectionManager.

Definition at line 89 of file ConnectionManager.php.

References DB_PRIMARY.


The documentation for this class was generated from the following file: