diff options
author | Andreas Fischer <bantu@owncloud.com> | 2014-06-12 19:55:26 +0200 |
---|---|---|
committer | Andreas Fischer <bantu@owncloud.com> | 2014-06-12 19:56:51 +0200 |
commit | 17c2e63449ed4c3afa31e6a424eb4e208596b906 (patch) | |
tree | 00ff6b79125e7f3f0415f75c932cf14af3afee54 /lib | |
parent | 4b87586487888e0d9fcc5700eefccc6ed031ce96 (diff) | |
download | nextcloud-server-17c2e63449ed4c3afa31e6a424eb4e208596b906.tar.gz nextcloud-server-17c2e63449ed4c3afa31e6a424eb4e208596b906.zip |
Move check for : to where it belongs, getting rid of $socket = false;
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/db.php | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/private/db.php b/lib/private/db.php index 6f0596f328e..df558dfce15 100644 --- a/lib/private/db.php +++ b/lib/private/db.php @@ -63,11 +63,6 @@ class OC_DB { $user = OC_Config::getValue( "dbuser", "" ); $pass = OC_Config::getValue( "dbpassword", "" ); $type = OC_Config::getValue( "dbtype", "sqlite" ); - if(strpos($host, ':')) { - list($host, $socket)=explode(':', $host, 2); - } else { - $socket=FALSE; - } $factory = new \OC\DB\ConnectionFactory(); if (!$factory->isValidType($type)) { @@ -83,15 +78,17 @@ class OC_DB { $datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data'); $connectionParams['path'] = $datadir.'/'.$name.'.db'; } else { - $connectionParams['host'] = $host; - $connectionParams['dbname'] = $name; - if ($socket) { + if (strpos($host, ':')) { + // Host variable may carry a port or socket. + list($host, $socket) = explode(':', $host, 2); if (ctype_digit($socket) && $socket <= 65535) { $connectionParams['port'] = $socket; } else { $connectionParams['unix_socket'] = $socket; } } + $connectionParams['host'] = $host; + $connectionParams['dbname'] = $name; } $connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_'); |