<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
private $log_date;
private $interval;
- function __construct($log_conn_id, $log_date, $interval = '10 SECOND') {
+ /**
+ * @param int $log_conn_id
+ * @param $log_date
+ * @param string $interval
+ */
+ public function __construct($log_conn_id, $log_date, $interval = '10 SECOND') {
$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->interval = $interval;
}
- function diffsInTables($tables) {
+ /**
+ * @param $tables
+ *
+ * @return array
+ */
+ public function diffsInTables($tables) {
$diffs = array();
foreach ($tables as $table) {
$diff = $this->diffsInTable($table);
return $diffs;
}
- function diffsInTable($table, $contactID = null) {
+ /**
+ * @param $table
+ * @param int $contactID
+ *
+ * @return array
+ */
+ public function diffsInTable($table, $contactID = null) {
$diffs = array();
$params = array(
$contactIdClause = "AND id = %3";
break;
case 'civicrm_note':
- $contactIdClause = "AND ( entity_id = %3 AND entity_table = 'civicrm_contact' ) OR (entity_id IN (SELECT note.id FROM `{$this->db}`.log_civicrm_note note WHERE note.entity_id = %3 AND note.entity_table = 'civicrm_contact') AND entity_table = 'civicrm_note')";
+ $contactIdClause = "AND (( entity_id = %3 AND entity_table = 'civicrm_contact' ) OR (entity_id IN (SELECT note.id FROM `{$this->db}`.log_civicrm_note note WHERE note.entity_id = %3 AND note.entity_table = 'civicrm_contact') AND entity_table = 'civicrm_note'))";
break;
case 'civicrm_entity_tag':
$contactIdClause = "AND entity_id = %3 AND entity_table = 'civicrm_contact'";
return $diffs;
}
+ /**
+ * @param $table
+ * @param int $id
+ *
+ * @return array
+ */
private function diffsInTableForId($table, $id) {
$diffs = array();
return $diffs;
}
- function titlesAndValuesForTable($table) {
+ /**
+ * @param $table
+ *
+ * @return array
+ */
+ public function titlesAndValuesForTable($table) {
// static caches for subsequent calls with the same $table
static $titles = array();
static $values = array();
}
elseif (substr($table, 0, 14) == 'civicrm_value_') {
list($titles[$table], $values[$table]) = $this->titlesAndValuesForCustomDataTable($table);
- } else {
+ }
+ else {
$titles[$table] = $values[$table] = array();
}
}
return array($titles[$table], $values[$table]);
}
+ /**
+ * @param $sql
+ * @param array $params
+ *
+ * @return mixed
+ */
private function sqlToArray($sql, $params) {
$dao = CRM_Core_DAO::executeQuery($sql, $params);
$dao->fetch();
return $dao->toArray();
}
+ /**
+ * @param $table
+ *
+ * @return array
+ */
private function titlesAndValuesForCustomDataTable($table) {
$titles = array();
$values = array();
return array($titles, $values);
}
}
-