Skip to content
Browse files

add SSL support to MySQL PDO connections

  • Loading branch information...
1 parent c5e3bbe commit c780ded5129d2143f2c2c50c34779dfc1e1fe491 @mikescar mikescar committed with markstory
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/Cake/Model/Datasource/Database/Mysql.php
View
8 lib/Cake/Model/Datasource/Database/Mysql.php
@@ -146,7 +146,13 @@ public function connect() {
if (!empty($config['encoding'])) {
$flags[PDO::MYSQL_ATTR_INIT_COMMAND] = 'SET NAMES ' . $config['encoding'];
}
-
+ if (!empty($config['ssl_key']) && !empty($config['ssl_cert'])) {
+ $flags[PDO::MYSQL_ATTR_SSL_KEY] = $config['ssl_key'];
+ $flags[PDO::MYSQL_ATTR_SSL_CERT] = $config['ssl_cert'];
+ }
+ if (!empty($config['ssl_ca'])) {
+ $flags[PDO::MYSQL_ATTR_SSL_CA] = $config['ssl_ca'];
+ }
if (empty($config['unix_socket'])) {
$dsn = "mysql:host={$config['host']};port={$config['port']};dbname={$config['database']}";
} else {

0 comments on commit c780ded

Please sign in to comment.
Something went wrong with that request. Please try again.