Merge pull request #18270 from seamuslee001/auto_dsn
[civicrm-core.git] / CRM / Logging / ReportDetail.php
index d239a602da27af5d06c540e7a3b3073c1550656f..fdbd92216a895882e7e64861f067e6119585fb40 100644 (file)
@@ -203,10 +203,10 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form {
         ) {
           $froms = $tos = [];
           foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($from, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) {
-            $froms[] = CRM_Utils_Array::value($val, $values[$field]);
+            $froms[] = $values[$field][$val] ?? NULL;
           }
           foreach (explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($to, CRM_Core_DAO::VALUE_SEPARATOR)) as $val) {
-            $tos[] = CRM_Utils_Array::value($val, $values[$field]);
+            $tos[] = $values[$field][$val] ?? NULL;
           }
           $from = implode(', ', array_filter($froms));
           $to = implode(', ', array_filter($tos));
@@ -257,7 +257,8 @@ class CRM_Logging_ReportDetail extends CRM_Report_Form {
    * Store the dsn for the logging database in $this->db.
    */
   protected function storeDB() {
-    $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
+    $dsn = defined('CIVICRM_LOGGING_DSN') ? CRM_Utils_SQL::autoSwitchDSN(CIVICRM_LOGGING_DSN) : CRM_Utils_SQL::autoSwitchDSN(CIVICRM_DSN);
+    $dsn = DB::parseDSN($dsn);
     $this->db = $dsn['database'];
   }