MediaWiki REL1_39
Wikimedia\Rdbms\ConnectionManager Class Reference

Database connection manager. More...

Inheritance diagram for Wikimedia\Rdbms\ConnectionManager:

Public Member Functions

 __construct (ILoadBalancer $loadBalancer, $domain=false, array $groups=[])
 
 getLazyReadConnectionRef (array $groups=null)
 Returns a lazy-connecting database connection ref for reading.
 
 getLazyWriteConnectionRef ()
 Returns a lazy-connecting database connection ref for updating.
 
 getReadConnection (?array $groups=null, int $flags=0)
 Returns a database connection for reading.
 
 getReadConnectionRef (array $groups=null)
 Returns a database connection ref for reading.
 
 getWriteConnection (int $flags=0)
 Returns a connection to the primary DB, for updating.
 
 getWriteConnectionRef ()
 Returns a connection ref to the primary DB, for updating.
 
 releaseConnection (IDatabase $db)
 

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

◆ getLazyReadConnectionRef()

Wikimedia\Rdbms\ConnectionManager::getLazyReadConnectionRef ( array $groups = null)

Returns a lazy-connecting database connection ref for reading.

Since
1.37
Parameters
string[] | null$groups
Returns
DBConnRef
Deprecated
since 1.39; Use getReadConnection()

Definition at line 170 of file ConnectionManager.php.

References DB_REPLICA.

◆ getLazyWriteConnectionRef()

Wikimedia\Rdbms\ConnectionManager::getLazyWriteConnectionRef ( )

Returns a lazy-connecting database connection ref for updating.

Since
1.38
Returns
DBConnRef
Deprecated
since 1.39; Use getWriteConnection()

Definition at line 158 of file ConnectionManager.php.

◆ 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
IDatabase

Reimplemented in Wikimedia\Rdbms\SessionConsistentConnectionManager.

Definition at line 112 of file ConnectionManager.php.

References DB_REPLICA.

◆ getReadConnectionRef()

Wikimedia\Rdbms\ConnectionManager::getReadConnectionRef ( array $groups = null)

Returns a database connection ref for reading.

Since
1.29
Parameters
string[] | null$groups
Returns
DBConnRef
Deprecated
since 1.38; Use getReadConnection()

Reimplemented in Wikimedia\Rdbms\SessionConsistentConnectionManager.

Definition at line 146 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 99 of file ConnectionManager.php.

References DB_PRIMARY.

◆ getWriteConnectionRef()

Wikimedia\Rdbms\ConnectionManager::getWriteConnectionRef ( )

Returns a connection ref to the primary DB, for updating.

Since
1.29
Returns
DBConnRef
Deprecated
since 1.39; Use getWriteConnection()

Reimplemented in Wikimedia\Rdbms\SessionConsistentConnectionManager.

Definition at line 134 of file ConnectionManager.php.

References DB_PRIMARY.

◆ releaseConnection()

Wikimedia\Rdbms\ConnectionManager::releaseConnection ( IDatabase $db)
Since
1.29
Parameters
IDatabase$db
Deprecated
since 1.38

Definition at line 122 of file ConnectionManager.php.


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