From c2b20fc0b4c6c1271fff9a85cb977d23de0a3421 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Tue, 31 Jul 2012 07:21:03 -0400
Subject: [PATCH] Added support for SSL connection parameters in mysql driver (#1486594)

---
 program/include/rcube_db_mysql.php |   38 ++++++++++++++++++++++++++++++++++++++
 1 files changed, 38 insertions(+), 0 deletions(-)

diff --git a/program/include/rcube_db_mysql.php b/program/include/rcube_db_mysql.php
index 38b15fa..3606ec1 100644
--- a/program/include/rcube_db_mysql.php
+++ b/program/include/rcube_db_mysql.php
@@ -59,6 +59,10 @@
 
     /**
      * 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 @@
     }
 
     /**
+     * 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

--
Gitblit v1.9.1