Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjosh4trunks <joshruehlig@gmail.com>2014-06-05 09:50:23 +0400
committerjosh4trunks <joshruehlig@gmail.com>2014-06-05 09:50:23 +0400
commite77c9bb97ed56d30c08f7d7ea9c06dd80ac9467b (patch)
tree5da81f74720f0fc6d675409fb74b0e0496d9ce74 /lib/private/db.php
parent39eeb7def9cad026698d2b6a97bde8a8e1b34d50 (diff)
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
Diffstat (limited to 'lib/private/db.php')
-rw-r--r--lib/private/db.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/private/db.php b/lib/private/db.php
index 422f783c745..16030a20f89 100644
--- a/lib/private/db.php
+++ b/lib/private/db.php
@@ -65,6 +65,9 @@ class OC_DB {
$type = OC_Config::getValue( "dbtype", "sqlite" );
if(strpos($host, ':')) {
list($host, $port)=explode(':', $host, 2);
+ if(!is_int($port)||$port<1||$port>65535) {
+ $socket=true;
+ }
} else {
$port=false;
}
@@ -89,7 +92,11 @@ class OC_DB {
'dbname' => $name,
);
if (!empty($port)) {
- $connectionParams['port'] = $port;
+ if ($socket) {
+ $connectionParams['unix_socket'] = $port;
+ } else {
+ $connectionParams['port'] = $port;
+ }
}
}