Skip to content
Snippets Groups Projects
Commit 4ca1e3cc authored by Andreas Fischer's avatar Andreas Fischer
Browse files

Move getValue() to where required. This actually is not required "global data".

parent 17c2e634
No related branches found
No related tags found
No related merge requests found
...@@ -57,27 +57,23 @@ class OC_DB { ...@@ -57,27 +57,23 @@ class OC_DB {
return true; return true;
} }
// The global data we need $type = OC_Config::getValue('dbtype', 'sqlite');
$name = OC_Config::getValue( "dbname", "owncloud" );
$host = OC_Config::getValue( "dbhost", "" );
$user = OC_Config::getValue( "dbuser", "" );
$pass = OC_Config::getValue( "dbpassword", "" );
$type = OC_Config::getValue( "dbtype", "sqlite" );
$factory = new \OC\DB\ConnectionFactory(); $factory = new \OC\DB\ConnectionFactory();
if (!$factory->isValidType($type)) { if (!$factory->isValidType($type)) {
return false; return false;
} }
$connectionParams = array( $connectionParams = array(
'user' => $user, 'user' => OC_Config::getValue('dbuser', ''),
'password' => $pass, 'password' => OC_Config::getValue('dbpassword', ''),
); );
$name = OC_Config::getValue('dbname', 'owncloud');
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['path'] = $datadir.'/'.$name.'.db'; $connectionParams['path'] = $datadir.'/'.$name.'.db';
} else { } else {
$host = OC_Config::getValue('dbhost', '');
if (strpos($host, ':')) { if (strpos($host, ':')) {
// Host variable may carry a port or socket. // Host variable may carry a port or socket.
list($host, $socket) = explode(':', $host, 2); list($host, $socket) = explode(':', $host, 2);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment