<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2014 |
+ | Copyright CiviCRM LLC (c) 2004-2015 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
| GNU Affero General Public License or the licensing of CiviCRM, |
| see the CiviCRM license FAQ at http://civicrm.org/licensing |
+--------------------------------------------------------------------+
-*/
+ */
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2014
+ * @copyright CiviCRM LLC (c) 2004-2015
* $Id$
*
*/
* @param int $log_conn_id
* @param $log_date
*/
- function __construct($log_conn_id, $log_date) {
- $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
- $this->db = $dsn['database'];
+ public function __construct($log_conn_id, $log_date) {
+ $dsn = defined('CIVICRM_LOGGING_DSN') ? DB::parseDSN(CIVICRM_LOGGING_DSN) : DB::parseDSN(CIVICRM_DSN);
+ $this->db = $dsn['database'];
$this->log_conn_id = $log_conn_id;
- $this->log_date = $log_date;
+ $this->log_date = $log_date;
}
/**
* @param $tables
*/
- function revert($tables) {
+ public function revert($tables) {
// FIXME: split off the table → DAO mapping to a GenCode-generated class
$daos = array(
'civicrm_address' => 'CRM_Core_DAO_Address',
// DAO-based tables
case in_array($table, array_keys($daos)):
- $dao = new $daos[$table];
+ $dao = new $daos[$table]();
foreach ($row as $id => $changes) {
$dao->id = $id;
foreach ($changes as $field => $value) {
$dao->reset();
}
break;
+
// custom data tables
case in_array($table, array_keys($ctypes)):
foreach ($row as $id => $changes) {
$inserts = array('id' => '%1');
$updates = array();
- $params = array(1 => array($id, 'Integer'));
+ $params = array(1 => array($id, 'Integer'));
$counter = 2;
foreach ($changes as $field => $value) {
// don’t try reverting a field that’s no longer there
$value = CRM_Utils_Date::isoToMysql($value);
break;
}
- $inserts[$field] = "%$counter";
- $updates[] = "$field = %$counter";
+ $inserts[$field] = "%$counter";
+ $updates[] = "$field = %$counter";
$params[$counter] = array($value, $ctypes[$table][$field]);
$counter++;
}
return;
}
- $dao = new CRM_Contact_DAO_Contact;
+ $dao = new CRM_Contact_DAO_Contact();
$dao->id = $cid;
if ($dao->find(TRUE)) {
// CRM-8102: MySQL can’t parse its own dates
}
}
}
-}
+}