|
|
|
@ -16,8 +16,11 @@ class OCI extends AbstractDatabase { |
|
|
|
|
} |
|
|
|
|
// allow empty hostname for oracle |
|
|
|
|
$this->dbhost = $config['dbhost']; |
|
|
|
|
\OC_Config::setValue('dbhost', $this->dbhost); |
|
|
|
|
\OC_Config::setValue('dbtablespace', $this->dbtablespace); |
|
|
|
|
|
|
|
|
|
\OC_Config::setValues([ |
|
|
|
|
'dbhost' => $this->dbhost, |
|
|
|
|
'dbtablespace' => $this->dbtablespace, |
|
|
|
|
]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public function validate($config) { |
|
|
|
@ -72,37 +75,32 @@ class OCI extends AbstractDatabase { |
|
|
|
|
$result = oci_execute($stmt); |
|
|
|
|
if($result) { |
|
|
|
|
$row = oci_fetch_row($stmt); |
|
|
|
|
} |
|
|
|
|
if($result and $row[0] > 0) { |
|
|
|
|
//use the admin login data for the new database user |
|
|
|
|
|
|
|
|
|
//add prefix to the oracle user name to prevent collisions |
|
|
|
|
$this->dbuser='oc_'.$username; |
|
|
|
|
//create a new password so we don't need to store the admin config in the config file |
|
|
|
|
$this->dbpassword=\OC_Util::generateRandomBytes(30); |
|
|
|
|
if ($row[0] > 0) { |
|
|
|
|
//use the admin login data for the new database user |
|
|
|
|
|
|
|
|
|
//oracle passwords are treated as identifiers: |
|
|
|
|
// must start with alphanumeric char |
|
|
|
|
// needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. |
|
|
|
|
$this->dbpassword=substr($this->dbpassword, 0, 30); |
|
|
|
|
//add prefix to the oracle user name to prevent collisions |
|
|
|
|
$this->dbuser='oc_'.$username; |
|
|
|
|
//create a new password so we don't need to store the admin config in the config file |
|
|
|
|
$this->dbpassword=\OC_Util::generateRandomBytes(30); |
|
|
|
|
|
|
|
|
|
$this->createDBUser($connection); |
|
|
|
|
//oracle passwords are treated as identifiers: |
|
|
|
|
// must start with alphanumeric char |
|
|
|
|
// needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length. |
|
|
|
|
$this->dbpassword=substr($this->dbpassword, 0, 30); |
|
|
|
|
|
|
|
|
|
\OC_Config::setValue('dbuser', $this->dbuser); |
|
|
|
|
\OC_Config::setValue('dbname', $this->dbuser); |
|
|
|
|
\OC_Config::setValue('dbpassword', $this->dbpassword); |
|
|
|
|
|
|
|
|
|
//create the database not necessary, oracle implies user = schema |
|
|
|
|
//$this->createDatabase($this->dbname, $this->dbuser, $connection); |
|
|
|
|
} else { |
|
|
|
|
$this->createDBUser($connection); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
\OC_Config::setValue('dbuser', $this->dbuser); |
|
|
|
|
\OC_Config::setValue('dbname', $this->dbname); |
|
|
|
|
\OC_Config::setValue('dbpassword', $this->dbpassword); |
|
|
|
|
\OC_Config::setValues([ |
|
|
|
|
'dbuser' => $this->dbuser, |
|
|
|
|
'dbname' => $this->dbname, |
|
|
|
|
'dbpassword' => $this->dbpassword, |
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
//create the database not necessary, oracle implies user = schema |
|
|
|
|
//$this->createDatabase($this->dbname, $this->dbuser, $connection); |
|
|
|
|
} |
|
|
|
|
//create the database not necessary, oracle implies user = schema |
|
|
|
|
//$this->createDatabase($this->dbname, $this->dbuser, $connection); |
|
|
|
|
|
|
|
|
|
//FIXME check tablespace exists: select * from user_tablespaces |
|
|
|
|
|
|
|
|
|