diff options
author | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-11-06 21:28:26 +0400 |
---|---|---|
committer | Jörn Friedrich Dreyer <jfd@butonic.de> | 2013-11-06 21:28:26 +0400 |
commit | 5965b68cc3fc212756a2904086f051136103003f (patch) | |
tree | bc786be476ad70434e1c58d785847e3d8f6bd961 /lib/db.php | |
parent | d490b8f97247fdd2382330e9c2be7ac8e0471ca4 (diff) |
fix enabling apps for oracle cornercase
Diffstat (limited to 'lib/db.php')
-rw-r--r-- | lib/db.php | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/lib/db.php b/lib/db.php index 01f88647600..4932c5fb500 100644 --- a/lib/db.php +++ b/lib/db.php @@ -561,9 +561,29 @@ class OC_DB { * TODO: write more documentation */ public static function createDbFromStructure( $file ) { - $CONFIG_DBNAME = OC_Config::getValue( "dbname", "owncloud" ); - $CONFIG_DBTABLEPREFIX = OC_Config::getValue( "dbtableprefix", "oc_" ); - $CONFIG_DBTYPE = OC_Config::getValue( "dbtype", "sqlite" ); + $CONFIG_DBNAME = OC_Config::getValue('dbname', 'owncloud'); + $CONFIG_DBTABLEPREFIX = OC_Config::getValue('dbtableprefix', 'oc_'); + $CONFIG_DBTYPE = OC_Config::getValue('dbtype', 'sqlite'); + $CONFIG_DBHOST = OC_Config::getValue('dbhost', ''); + + if( $CONFIG_DBTYPE === 'oci' + && $CONFIG_DBNAME === '' + && $CONFIG_DBHOST !== null && $CONFIG_DBHOST !== '' + ) { + // we are connecting by user name, pwd and SID (host) + $CONFIG_DBUSER = OC_Config::getValue('dbuser', ''); + $CONFIG_DBPASSWORD = OC_Config::getValue('dbpassword'); + if ($CONFIG_DBUSER !== '' + && $CONFIG_DBPASSWORD !== '' + ) { + // use dbuser as dbname + $CONFIG_DBNAME = $CONFIG_DBUSER; + } else { + throw new DatabaseException('Please specify ' + .'username and password when ' + .'connecting via SID as the hostname.'); + } + } // cleanup the cached queries self::$preparedQueries = array(); |