Changeset View
Changeset View
Standalone View
Standalone View
core/kernel/db/db_load_balancer.php
Show First 20 Lines • Show All 138 Lines • ▼ Show 20 Line(s) | |||||
* @param Array $config | * @param Array $config | ||||
* @return void | * @return void | ||||
* @access public | * @access public | ||||
*/ | */ | ||||
public function setup($config) | public function setup($config) | ||||
{ | { | ||||
$this->servers = Array (); | $this->servers = Array (); | ||||
$this->servers[0] = Array ( | $this->servers[0] = Array ( | ||||
Lint: CodingStandard.Arrays.Array.SpaceAfterKeyword: There must be no space between the Array keyword and the opening parenthesis | |||||
PHP keywords must be lowercase; expected "array" but found "Array" Lint: Generic.PHP.LowerCaseKeyword.Found: PHP keywords must be lowercase; expected "array" but found "Array" | |||||
'DBErrorBackoffMaxRetryAttempts' => $config['Database']['DBErrorBackoffMaxRetryAttempts'], | |||||
'DBErrorBackoffLogicBaseTime' => $config['Database']['DBErrorBackoffLogicBaseTime'], | |||||
'DBEnableLockRetryDebugging' => $config['Database']['DBEnableLockRetryDebugging'], | |||||
'DBHost' => $config['Database']['DBHost'], | 'DBHost' => $config['Database']['DBHost'], | ||||
'DBUser' => $config['Database']['DBUser'], | 'DBUser' => $config['Database']['DBUser'], | ||||
'DBUserPassword' => $config['Database']['DBUserPassword'], | 'DBUserPassword' => $config['Database']['DBUserPassword'], | ||||
'DBName' => $config['Database']['DBName'], | 'DBName' => $config['Database']['DBName'], | ||||
'DBLoad' => 0, | 'DBLoad' => 0, | ||||
); | ); | ||||
if ( isset($config['Databases']) ) { | if ( isset($config['Databases']) ) { | ||||
▲ Show 20 Lines • Show All 341 Lines • ▼ Show 20 Line(s) | |||||
protected function &reallyOpenConnection($server, $is_master) | protected function &reallyOpenConnection($server, $is_master) | ||||
{ | { | ||||
$debug_mode = $this->Application->isDebugMode(); | $debug_mode = $this->Application->isDebugMode(); | ||||
$db_class = $debug_mode ? 'kDBConnectionDebug' : 'kDBConnection'; | $db_class = $debug_mode ? 'kDBConnectionDebug' : 'kDBConnection'; | ||||
/** @var kDBConnection $db */ | /** @var kDBConnection $db */ | ||||
$db = $this->Application->makeClass($db_class, Array ($this->dbType, $this->errorHandler, $server['serverIndex'])); | $db = $this->Application->makeClass($db_class, Array ($this->dbType, $this->errorHandler, $server['serverIndex'])); | ||||
$db->debugMode = $debug_mode; | $config = array( | ||||
$db->Connect($server['DBHost'], $server['DBUser'], $server['DBUserPassword'], $this->servers[0]['DBName'], !$is_master); | 'Database' => array( | ||||
'DBErrorBackoffMaxRetryAttempts' => $this->servers[0]['DBErrorBackoffMaxRetryAttempts'], | |||||
'DBErrorBackoffLogicBaseTime' => $this->servers[0]['DBErrorBackoffLogicBaseTime'], | |||||
'DBEnableLockRetryDebugging' => $this->servers[0]['DBEnableLockRetryDebugging'], | |||||
'DBHost' => $server['DBHost'], | |||||
'DBUser' => $server['DBUser'], | |||||
'DBUserPassword' => $server['DBUserPassword'], | |||||
'DBName' => $this->servers[0]['DBName'], | |||||
'DBRetry' => !$is_master, | |||||
), | |||||
); | |||||
$db->setup($config); | |||||
return $db; | return $db; | ||||
} | } | ||||
/** | /** | ||||
* Returns first field of first line of recordset if query ok or false otherwise. | * Returns first field of first line of recordset if query ok or false otherwise. | ||||
* | * | ||||
* @param string $sql | * @param string $sql | ||||
▲ Show 20 Lines • Show All 383 Lines • Show Last 20 Lines |
There must be no space between the Array keyword and the opening parenthesis