summaryrefslogtreecommitdiff
path: root/program/include
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-07-31 13:21:03 +0200
committerAleksander Machniak <alec@alec.pl>2012-07-31 13:21:03 +0200
commitc2b20fc0b4c6c1271fff9a85cb977d23de0a3421 (patch)
tree2a78310197e31bad00c4f9e36c6dc1b43f3ed9ae /program/include
parent146106a827b84fa3342fb7afef5919b94c10a797 (diff)
Added support for SSL connection parameters in mysql driver (#1486594)
Diffstat (limited to 'program/include')
-rw-r--r--program/include/rcube_db_mysql.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/program/include/rcube_db_mysql.php b/program/include/rcube_db_mysql.php
index 38b15fa42..3606ec102 100644
--- a/program/include/rcube_db_mysql.php
+++ b/program/include/rcube_db_mysql.php
@@ -59,6 +59,10 @@ class rcube_db_mysql extends rcube_db
/**
* Returns PDO DSN string from DSN array
+ *
+ * @param array $dsn DSN parameters
+ *
+ * @return string Connection string
*/
protected function dsn_string($dsn)
{
@@ -91,6 +95,40 @@ class rcube_db_mysql extends rcube_db
}
/**
+ * Returns driver-specific connection options
+ *
+ * @param array $dsn DSN parameters
+ *
+ * @return array Connection options
+ */
+ protected function dsn_options($dsn)
+ {
+ $result = array();
+
+ if (!empty($dsn['key'])) {
+ $result[PDO::MYSQL_ATTR_KEY] = $dsn['key'];
+ }
+
+ if (!empty($dsn['cipher'])) {
+ $result[PDO::MYSQL_ATTR_CIPHER] = $dsn['cipher'];
+ }
+
+ if (!empty($dsn['cert'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CERT] = $dsn['cert'];
+ }
+
+ if (!empty($dsn['capath'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CAPATH] = $dsn['capath'];
+ }
+
+ if (!empty($dsn['ca'])) {
+ $result[PDO::MYSQL_ATTR_SSL_CA] = $dsn['ca'];
+ }
+
+ return $result;
+ }
+
+ /**
* Get database runtime variables
*
* @param string $varname Variable name