MediaWiki  master
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. More...
 
 getLazyWriteConnectionRef ()
 Returns a lazy-connecting database connection ref for updating. More...
 
 getReadConnection (?array $groups=null, int $flags=0)
 Returns a database connection for reading. More...
 
 getReadConnectionRef (array $groups=null)
 Returns a database connection ref for reading. More...
 
 getWriteConnection (int $flags=0)
 Returns a connection to the primary DB, for updating. More...
 
 getWriteConnectionRef ()
 Returns a connection ref to the primary DB, for updating. More...
 
 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 174 of file ConnectionManager.php.

References DB_REPLICA, and wfDeprecated().

◆ 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 161 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
IReadableDatabase

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 148 of file ConnectionManager.php.

References DB_REPLICA, and wfDeprecated().

◆ 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 135 of file ConnectionManager.php.

References DB_PRIMARY, and wfDeprecated().

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

References wfDeprecated().


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