MediaWiki  REL1_22
LBFactory_Single.php
Go to the documentation of this file.
00001 <?php
00027 class LBFactory_Single extends LBFactory {
00028     protected $lb;
00029 
00034     function __construct( $conf ) {
00035         $this->lb = new LoadBalancer_Single( $conf );
00036     }
00037 
00043     function newMainLB( $wiki = false ) {
00044         return $this->lb;
00045     }
00046 
00052     function getMainLB( $wiki = false ) {
00053         return $this->lb;
00054     }
00055 
00062     function newExternalLB( $cluster, $wiki = false ) {
00063         return $this->lb;
00064     }
00065 
00072     function &getExternalLB( $cluster, $wiki = false ) {
00073         return $this->lb;
00074     }
00075 
00080     function forEachLB( $callback, $params = array() ) {
00081         call_user_func_array( $callback, array_merge( array( $this->lb ), $params ) );
00082     }
00083 }
00084 
00088 class LoadBalancer_Single extends LoadBalancer {
00089 
00093     var $db;
00094 
00098     function __construct( $params ) {
00099         $this->db = $params['connection'];
00100         parent::__construct( array( 'servers' => array( array(
00101             'type' => $this->db->getType(),
00102             'host' => $this->db->getServer(),
00103             'dbname' => $this->db->getDBname(),
00104             'load' => 1,
00105         ) ) ) );
00106     }
00107 
00115     function reallyOpenConnection( $server, $dbNameOverride = false ) {
00116         return $this->db;
00117     }
00118 }