dev/core#2726 - Set ssl option when using DSN with SSL
authorErawat Chamanont <erawat@gmail.com>
Thu, 29 Jul 2021 20:25:40 +0000 (21:25 +0100)
committerErawat Chamanont <erawat@gmail.com>
Thu, 29 Jul 2021 20:25:40 +0000 (21:25 +0100)
CRM/Utils/File.php

index 79bbbd4dfc62eb4fd8005cbc19360eceb8210ad1..d50ee48d770d78fdc48a535cf27d0577af5579b7 100644 (file)
@@ -327,7 +327,8 @@ class CRM_Utils_File {
       require_once 'DB.php';
       $dsn = CRM_Utils_SQL::autoSwitchDSN($dsn);
       try {
-        $db = DB::connect($dsn);
+        $options = CRM_Utils_SQL::isSSLDSN($dsn) ? ['ssl' => TRUE] : [];
+        $db = DB::connect($dsn, $options);
       }
       catch (Exception $e) {
         die("Cannot open $dsn: " . $e->getMessage());