Merge pull request #1 from josh4trunks/patch-1
Support user defined MySQL Port/Socket in API
This commit is contained in:
commit
e804cfbc16
|
@ -67,7 +67,6 @@ class DATABASE_CONFIG {
|
|||
public $default = array(
|
||||
'datasource' => 'Database/Mysql',
|
||||
'persistent' => false,
|
||||
'host' => ZM_DB_HOST,
|
||||
'login' => ZM_DB_USER,
|
||||
'password' => ZM_DB_PASS,
|
||||
'database' => ZM_DB_NAME,
|
||||
|
@ -85,4 +84,18 @@ class DATABASE_CONFIG {
|
|||
'prefix' => '',
|
||||
//'encoding' => 'utf8',
|
||||
);
|
||||
|
||||
public function __construct() {
|
||||
if (strpos(ZM_DB_HOST, ':')):
|
||||
$array = explode(':', ZM_DB_HOST, 2);
|
||||
if (is_numeric($array[1])):
|
||||
$this->default['host'] = $array[0];
|
||||
$this->default['port'] = $array[1];
|
||||
else:
|
||||
$this->default['unix_socket'] = $array[1];
|
||||
endif;
|
||||
else:
|
||||
$this->default['host'] = ZM_DB_HOST;
|
||||
endif;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue