Extract common variables of $connectionParams.

This commit is contained in:
Andreas Fischer 2014-06-12 19:53:33 +02:00
parent 6da2beeaff
commit 4b87586487
1 changed files with 8 additions and 11 deletions

View File

@ -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;