MediaWiki
REL1_19
|
00001 <?php 00002 00006 class LBFactory_Single extends LBFactory { 00007 protected $lb; 00008 00013 function __construct( $conf ) { 00014 $this->lb = new LoadBalancer_Single( $conf ); 00015 } 00016 00022 function newMainLB( $wiki = false ) { 00023 return $this->lb; 00024 } 00025 00031 function getMainLB( $wiki = false ) { 00032 return $this->lb; 00033 } 00034 00041 function newExternalLB( $cluster, $wiki = false ) { 00042 return $this->lb; 00043 } 00044 00051 function &getExternalLB( $cluster, $wiki = false ) { 00052 return $this->lb; 00053 } 00054 00059 function forEachLB( $callback, $params = array() ) { 00060 call_user_func_array( $callback, array_merge( array( $this->lb ), $params ) ); 00061 } 00062 } 00063 00067 class LoadBalancer_Single extends LoadBalancer { 00068 00072 var $db; 00073 00077 function __construct( $params ) { 00078 $this->db = $params['connection']; 00079 parent::__construct( array( 'servers' => array( array( 00080 'type' => $this->db->getType(), 00081 'host' => $this->db->getServer(), 00082 'dbname' => $this->db->getDBname(), 00083 'load' => 1, 00084 ) ) ) ); 00085 } 00086 00094 function reallyOpenConnection( $server, $dbNameOverride = false ) { 00095 return $this->db; 00096 } 00097 }