<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
/**
* Populate $this->tables and $this->logs with current db state.
*/
- function __construct() {
+ public function __construct() {
$dao = new CRM_Contact_DAO_Contact();
$civiDBName = $dao->_database;
/**
* Return logging custom data tables.
*/
- function customDataLogTables() {
+ public function customDataLogTables() {
return preg_grep('/^log_civicrm_value_/', $this->logs);
}
/**
* Return custom data tables for specified entity / extends.
*/
- function entityCustomDataLogTables($extends) {
+ public function entityCustomDataLogTables($extends) {
$customGroupTables = array();
$customGroupDAO = CRM_Core_BAO_CustomGroup::getAllCustomGroupsByBaseEntity($extends);
$customGroupDAO->find();
/**
* Disable logging by dropping the triggers (but keep the log tables intact).
*/
- function disableLogging() {
+ public function disableLogging() {
$config = CRM_Core_Config::singleton();
$config->logging = FALSE;
/**
* Drop triggers for all logged tables.
*/
- function dropTriggers($tableName = NULL) {
+ public function dropTriggers($tableName = NULL) {
$dao = new CRM_Core_DAO;
if ($tableName) {
*
* @return void
*/
- function enableLogging() {
+ public function enableLogging() {
$this->fixSchemaDifferences(TRUE);
$this->addReports();
}
*
* @return void
*/
- function fixSchemaDifferences($enableLogging = FALSE) {
+ public function fixSchemaDifferences($enableLogging = FALSE) {
$config = CRM_Core_Config::singleton();
if ($enableLogging) {
$config->logging = TRUE;
/**
* Add missing (potentially specified) log table columns for the given table.
*
- * @param $table string name of the relevant table
- * @param $cols mixed array of columns to add or null (to check for the missing columns)
- * @param $rebuildTrigger boolean should we rebuild the triggers
+ * @param $table
+ * String name of the relevant table.
+ * @param $cols
+ * Mixed array of columns to add or null (to check for the missing columns).
+ * @param $rebuildTrigger
+ * Boolean should we rebuild the triggers.
*
* @return void
*/
- function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
+ public function fixSchemaDifferencesFor($table, $cols = array(), $rebuildTrigger = FALSE) {
if (empty($table)) {
return FALSE;
}
/**
* @param bool $rebuildTrigger
*/
- function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
+ public function fixSchemaDifferencesForAll($rebuildTrigger = FALSE) {
$diffs = array();
foreach ($this->tables as $table) {
if (empty($this->logs[$table])) {
*
* @return mixed
*/
- function fixTimeStampAndNotNullSQL($query) {
+ public function fixTimeStampAndNotNullSQL($query) {
$query = str_ireplace("TIMESTAMP NOT NULL", "TIMESTAMP NULL", $query);
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP", '', $query);
$query = str_ireplace("DEFAULT CURRENT_TIMESTAMP", '', $query);
*
* @return array
*/
- function columnsWithDiffSpecs($civiTable, $logTable) {
+ public function columnsWithDiffSpecs($civiTable, $logTable) {
$civiTableSpecs = $this->columnSpecsOf($civiTable);
$logTableSpecs = $this->columnSpecsOf($logTable);
if ($civiTableSpecs[$col]['DATA_TYPE'] != CRM_Utils_Array::value('DATA_TYPE', $logTableSpecs[$col])) {
// if data-type is different, surely consider the column
$diff['MODIFY'][] = $col;
- } else if ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
+ }
+ else if ($civiTableSpecs[$col]['IS_NULLABLE'] != CRM_Utils_Array::value('IS_NULLABLE', $logTableSpecs[$col]) &&
$logTableSpecs[$col]['IS_NULLABLE'] == 'NO') {
// if is-null property is different, and log table's column is NOT-NULL, surely consider the column
$diff['MODIFY'][] = $col;
- } else if ($civiTableSpecs[$col]['COLUMN_DEFAULT'] != CRM_Utils_Array::value('COLUMN_DEFAULT', $logTableSpecs[$col]) &&
+ }
+ else if ($civiTableSpecs[$col]['COLUMN_DEFAULT'] != CRM_Utils_Array::value('COLUMN_DEFAULT', $logTableSpecs[$col]) &&
!strstr($civiTableSpecs[$col]['COLUMN_DEFAULT'], 'TIMESTAMP')) {
// if default property is different, and its not about a timestamp column, consider it
$diff['MODIFY'][] = $col;
* @param null $tableName
* @param bool $force
*/
- function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
+ public function triggerInfo(&$info, $tableName = NULL, $force = FALSE) {
// check if we have logging enabled
$config =& CRM_Core_Config::singleton();
if (!$config->logging) {
* an audit trail
*
* @static
- * @public
*/
- static function disableLoggingForThisConnection( ) {
+ public static function disableLoggingForThisConnection( ) {
// do this only if logging is enabled
$config = CRM_Core_Config::singleton( );
if ( $config->logging ) {
}
}
-