Merge branch 'develop' of github.com:nextcloud/user_sql into develop
This commit is contained in:
@@ -32,6 +32,9 @@ final class DB
|
||||
const DRIVER = "db.driver";
|
||||
const HOSTNAME = "db.hostname";
|
||||
const PASSWORD = "db.password";
|
||||
const SSL_CA = "db.ssl_ca";
|
||||
const SSL_CERT = "db.ssl_cert";
|
||||
const SSL_KEY = "db.ssl_key";
|
||||
const USERNAME = "db.username";
|
||||
|
||||
const GROUP_TABLE = "db.table.group";
|
||||
|
||||
@@ -146,6 +146,9 @@ class SettingsController extends Controller
|
||||
$dbDatabase = $this->request->getParam("db-database");
|
||||
$dbUsername = $this->request->getParam("db-username");
|
||||
$dbPassword = $this->request->getParam("db-password");
|
||||
$dbSSL_ca = $this->request->getParam("db-ssl_ca");
|
||||
$dbSSL_cert = $this->request->getParam("db-ssl_cert");
|
||||
$dbSSL_key = $this->request->getParam("db-ssl_key");
|
||||
|
||||
if (empty($dbDriver)) {
|
||||
throw new DatabaseException("No database driver specified.");
|
||||
@@ -160,9 +163,19 @@ class SettingsController extends Controller
|
||||
"password" => $dbPassword,
|
||||
"user" => $dbUsername,
|
||||
"dbname" => $dbDatabase,
|
||||
"tablePrefix" => ""
|
||||
"tablePrefix" => "",
|
||||
"driverOptions" => array()
|
||||
];
|
||||
|
||||
if ($dbDriver == 'mysql') {
|
||||
if ($dbSSL_ca)
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_CA] = \OC::$SERVERROOT.'/'.$dbSSL_ca;
|
||||
if ($dbSSL_cert)
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_CERT] = \OC::$SERVERROOT.'/'.$dbSSL_cert;
|
||||
if ($dbSSL_key)
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_KEY] = \OC::$SERVERROOT.'/'.$dbSSL_key;
|
||||
}
|
||||
|
||||
$connection = $connectionFactory->getConnection($dbDriver, $parameters);
|
||||
$connection->executeQuery("SELECT 'user_sql'");
|
||||
|
||||
@@ -216,6 +229,9 @@ class SettingsController extends Controller
|
||||
unset($this->properties[DB::PASSWORD]);
|
||||
unset($this->properties[DB::USERNAME]);
|
||||
unset($this->properties[DB::DATABASE]);
|
||||
unset($this->properties[DB::SSL_CA]);
|
||||
unset($this->properties[DB::SSL_CERT]);
|
||||
unset($this->properties[DB::SSL_KEY]);
|
||||
$this->properties[Opt::SAFE_STORE] = $safeStore;
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ class Properties implements \ArrayAccess
|
||||
*/
|
||||
private function isSystemValue($param)
|
||||
{
|
||||
return $this->safeStore && in_array($param, array(DB::HOSTNAME, DB::PASSWORD, DB::USERNAME, DB::DATABASE));
|
||||
return $this->safeStore && in_array($param, array(DB::HOSTNAME, DB::PASSWORD, DB::USERNAME, DB::DATABASE, DB::SSL_CA, DB::SSL_CERT, DB::SSL_KEY));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -145,9 +145,19 @@ class DataQuery
|
||||
"password" => $this->properties[DB::PASSWORD],
|
||||
"user" => $this->properties[DB::USERNAME],
|
||||
"dbname" => $this->properties[DB::DATABASE],
|
||||
"tablePrefix" => ""
|
||||
"tablePrefix" => "",
|
||||
"driverOptions" => array()
|
||||
);
|
||||
|
||||
if ($this->properties[DB::DRIVER] == 'mysql') {
|
||||
if ($this->properties[DB::SSL_CA])
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_CA] = \OC::$SERVERROOT.'/'.$this->properties[DB::SSL_CA];
|
||||
if ($this->properties[DB::SSL_CERT])
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_CERT] = \OC::$SERVERROOT.'/'.$this->properties[DB::SSL_CERT];
|
||||
if ($this->properties[DB::SSL_KEY])
|
||||
$parameters["driverOptions"][\PDO::MYSQL_ATTR_SSL_KEY] = \OC::$SERVERROOT.'/'.$this->properties[DB::SSL_KEY];
|
||||
}
|
||||
|
||||
$this->connection = $connectionFactory->getConnection(
|
||||
$this->properties[DB::DRIVER], $parameters
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user