Work with MySQL Sockets
This passes anything that is not a valid port (0<int<65535) as a unix socket. I tested this with unix sockets; this needs to be tested with a non-standard mysql port as well but I don't foresee any issues. To use a unix socket, even one different than PHP's mysql.default_socket.. * Database Host = localhost:/path/to/socket
This commit is contained in:
parent
39eeb7def9
commit
e77c9bb97e
|
@ -65,6 +65,9 @@ class OC_DB {
|
||||||
$type = OC_Config::getValue( "dbtype", "sqlite" );
|
$type = OC_Config::getValue( "dbtype", "sqlite" );
|
||||||
if(strpos($host, ':')) {
|
if(strpos($host, ':')) {
|
||||||
list($host, $port)=explode(':', $host, 2);
|
list($host, $port)=explode(':', $host, 2);
|
||||||
|
if(!is_int($port)||$port<1||$port>65535) {
|
||||||
|
$socket=true;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$port=false;
|
$port=false;
|
||||||
}
|
}
|
||||||
|
@ -89,7 +92,11 @@ class OC_DB {
|
||||||
'dbname' => $name,
|
'dbname' => $name,
|
||||||
);
|
);
|
||||||
if (!empty($port)) {
|
if (!empty($port)) {
|
||||||
$connectionParams['port'] = $port;
|
if ($socket) {
|
||||||
|
$connectionParams['unix_socket'] = $port;
|
||||||
|
} else {
|
||||||
|
$connectionParams['port'] = $port;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue