Skip to content
Permalink
Browse files

Add SSL support back to MySQL driver.

This was lost in the 2.x -> 3.x migration. Re-add the documented
options.
  • Loading branch information...
markstory committed Nov 13, 2013
1 parent 0e69337 commit ade1d087ee13d1d963c2e1f562d4804294d54308
Showing with 9 additions and 0 deletions.
  1. +9 −0 Cake/Database/Driver/Mysql.php
@@ -59,13 +59,22 @@ public function connect() {
}
$config['init'][] = sprintf("SET time_zone = '%s'", $config['timezone']);
$config['flags'] += [
PDO::ATTR_PERSISTENT => $config['persistent'],
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true,
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::MYSQL_ATTR_INIT_COMMAND => implode(';', (array)$config['init'])
];
if (!empty($config['ssl_key']) && !empty($config['ssl_cert'])) {
$config['flags'][PDO::MYSQL_ATTR_SSL_KEY] = $config['ssl_key'];
$config['flags'][PDO::MYSQL_ATTR_SSL_CERT] = $config['ssl_cert'];
}
if (!empty($config['ssl_ca'])) {
$config['flags'][PDO::MYSQL_ATTR_SSL_CA] = $config['ssl_ca'];
}
if (empty($config['dsn'])) {
if (empty($config['unix_socket'])) {
$config['dsn'] = "mysql:host={$config['host']};port={$config['port']};dbname={$config['database']};charset={$config['encoding']}";

0 comments on commit ade1d08

Please sign in to comment.
You can’t perform that action at this time.