MediaWiki  REL1_22
DBAccessBase.php
Go to the documentation of this file.
00001 <?php
00002 
00030 abstract class DBAccessBase implements IDBAccessObject {
00031 
00036     protected $wiki = false;
00037 
00042     public function __construct( $wiki = false ) {
00043         $this->wiki = $wiki;
00044     }
00045 
00059     protected function getConnection( $id, $groups = array() ) {
00060         $loadBalancer = wfGetLB( $this->wiki );
00061         return $loadBalancer->getConnection( $id, $groups, $this->wiki );
00062     }
00063 
00073     protected function releaseConnection( DatabaseBase $db ) {
00074         if ( $this->wiki !== false ) {
00075             $loadBalancer = $this->getLoadBalancer();
00076             $loadBalancer->reuseConnection( $db );
00077         }
00078     }
00079 
00089     public function getLoadBalancer() {
00090         return wfGetLB( $this->wiki );
00091     }
00092 }