Extract common variables of $connectionParams.
This commit is contained in:
parent
6da2beeaff
commit
4b87586487
|
@ -74,20 +74,17 @@ class OC_DB {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$connectionParams = array(
|
||||||
|
'user' => $user,
|
||||||
|
'password' => $pass,
|
||||||
|
);
|
||||||
|
|
||||||
if ($factory->normalizeType($type) === 'sqlite3') {
|
if ($factory->normalizeType($type) === 'sqlite3') {
|
||||||
$datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data');
|
$datadir = OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data');
|
||||||
$connectionParams = array(
|
$connectionParams['path'] = $datadir.'/'.$name.'.db';
|
||||||
'user' => $user,
|
|
||||||
'password' => $pass,
|
|
||||||
'path' => $datadir.'/'.$name.'.db',
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
$connectionParams = array(
|
$connectionParams['host'] = $host;
|
||||||
'user' => $user,
|
$connectionParams['dbname'] = $name;
|
||||||
'password' => $pass,
|
|
||||||
'host' => $host,
|
|
||||||
'dbname' => $name,
|
|
||||||
);
|
|
||||||
if ($socket) {
|
if ($socket) {
|
||||||
if (ctype_digit($socket) && $socket <= 65535) {
|
if (ctype_digit($socket) && $socket <= 65535) {
|
||||||
$connectionParams['port'] = $socket;
|
$connectionParams['port'] = $socket;
|
||||||
|
|
Loading…
Reference in New Issue