MediaWiki REL1_30
DBAccessBase.php
Go to the documentation of this file.
1<?php
2
5
33abstract class DBAccessBase implements IDBAccessObject {
38 protected $wiki = false;
39
44 public function __construct( $wiki = false ) {
45 $this->wiki = $wiki;
46 }
47
61 protected function getConnection( $id, $groups = [] ) {
62 $loadBalancer = wfGetLB( $this->wiki );
63
64 return $loadBalancer->getConnection( $id, $groups, $this->wiki );
65 }
66
76 protected function releaseConnection( Database $db ) {
77 if ( $this->wiki !== false ) {
78 $loadBalancer = $this->getLoadBalancer();
79 $loadBalancer->reuseConnection( $db );
80 }
81 }
82
92 public function getLoadBalancer() {
93 return wfGetLB( $this->wiki );
94 }
95}
wfGetLB( $wiki=false)
Get a load balancer object.
getLoadBalancer()
Get the database type used for read operations.
__construct( $wiki=false)
releaseConnection(Database $db)
Releases a database connection and makes it available for recycling.
getConnection( $id, $groups=[])
Returns a database connection.
Relational database abstraction object.
Definition Database.php:45
Database connection, tracking, load balancing, and transaction manager for a cluster.
Interface for database access objects.