Move check for : to where it belongs, getting rid of $socket = false;
This commit is contained in:
parent
4b87586487
commit
17c2e63449
|
@ -63,11 +63,6 @@ class OC_DB {
|
||||||
$user = OC_Config::getValue( "dbuser", "" );
|
$user = OC_Config::getValue( "dbuser", "" );
|
||||||
$pass = OC_Config::getValue( "dbpassword", "" );
|
$pass = OC_Config::getValue( "dbpassword", "" );
|
||||||
$type = OC_Config::getValue( "dbtype", "sqlite" );
|
$type = OC_Config::getValue( "dbtype", "sqlite" );
|
||||||
if(strpos($host, ':')) {
|
|
||||||
list($host, $socket)=explode(':', $host, 2);
|
|
||||||
} else {
|
|
||||||
$socket=FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
$factory = new \OC\DB\ConnectionFactory();
|
$factory = new \OC\DB\ConnectionFactory();
|
||||||
if (!$factory->isValidType($type)) {
|
if (!$factory->isValidType($type)) {
|
||||||
|
@ -83,15 +78,17 @@ class OC_DB {
|
||||||
$datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data');
|
$datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data');
|
||||||
$connectionParams['path'] = $datadir.'/'.$name.'.db';
|
$connectionParams['path'] = $datadir.'/'.$name.'.db';
|
||||||
} else {
|
} else {
|
||||||
$connectionParams['host'] = $host;
|
if (strpos($host, ':')) {
|
||||||
$connectionParams['dbname'] = $name;
|
// Host variable may carry a port or socket.
|
||||||
if ($socket) {
|
list($host, $socket) = explode(':', $host, 2);
|
||||||
if (ctype_digit($socket) && $socket <= 65535) {
|
if (ctype_digit($socket) && $socket <= 65535) {
|
||||||
$connectionParams['port'] = $socket;
|
$connectionParams['port'] = $socket;
|
||||||
} else {
|
} else {
|
||||||
$connectionParams['unix_socket'] = $socket;
|
$connectionParams['unix_socket'] = $socket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$connectionParams['host'] = $host;
|
||||||
|
$connectionParams['dbname'] = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_');
|
$connectionParams['tablePrefix'] = OC_Config::getValue('dbtableprefix', 'oc_');
|
||||||
|
|
Loading…
Reference in New Issue