CRM_Logging_Schema
class CRM_Logging_Schema
Methods
Setting Callback - Validate.
Setting Callback - On Change.
Populate $this->tables and $this->logs with current db state.
Return logging custom data tables.
Return custom data tables for specified entity / extends.
Disable logging by dropping the triggers (but keep the log tables intact).
Drop triggers for all logged tables.
Enable site-wide logging.
Sync log tables and rebuild triggers.
Update log tables structure.
Get the engine for the given table.
Get all the indexes in the table.
Add missing (potentially specified) log table columns for the given table.
Fix schema differences.
Fix timestamp.
Get columns that have changed.
Getter for logTableSpec.
Predicate whether logging is enabled.
Drop all log tables.
Get an sql clause to find the names of any log tables that do not match the normal pattern.
Get trigger info.
Disable logging temporarily.
Get all the log tables that reference civicrm_contact.
Details
at line 82
static bool
checkLoggingSupport(mixed $value, array $fieldSpec)
Setting Callback - Validate.
at line 104
static
onToggle(array $oldValue, array $newValue, array $metadata)
Setting Callback - On Change.
Respond to changes in the "logging" setting. Set up or destroy triggers, etal.
at line 121
__construct()
Populate $this->tables and $this->logs with current db state.
at line 187
customDataLogTables()
Return logging custom data tables.
at line 198
array
entityCustomDataLogTables(string $extends)
Return custom data tables for specified entity / extends.
at line 211
disableLogging()
Disable logging by dropping the triggers (but keep the log tables intact).
at line 228
dropTriggers(string $tableName = NULL)
Drop triggers for all logged tables.
at line 270
enableLogging()
Enable site-wide logging.
at line 280
fixSchemaDifferences(bool $enableLogging = FALSE)
Sync log tables and rebuild triggers.
at line 302
updateLogTableSchema()
Update log tables structure.
This function updates log tables to have the log_conn_id type of varchar and also implements any engine change to INNODB defined by the hooks.
Note changing engine & adding hook-defined indexes, but not changing back to ARCHIVE if engine has not been deliberately set (by hook) and not dropping indexes. Sysadmin will need to manually intervene to revert to defaults.
at line 345
string
getEngineForLogTable(string $table)
Get the engine for the given table.
at line 359
array
getIndexesForTable(string $table)
Get all the indexes in the table.
at line 380
bool
fixSchemaDifferencesFor(string $table, array $cols = array(), bool $rebuildTrigger = FALSE)
Add missing (potentially specified) log table columns for the given table.
at line 456
fixSchemaDifferencesForAll(bool $rebuildTrigger = FALSE)
Fix schema differences.
at line 487
mixed
fixTimeStampAndNotNullSQL(string $query)
Fix timestamp.
Log_civicrm_contact.modified_date for example would always be copied from civicrm_contact.modified_date, so there's no need for a default timestamp and therefore we remove such default timestamps also eliminate the NOT NULL constraint, since we always copy and schema can change down the road)
at line 607
array
columnsWithDiffSpecs(string $civiTable, string $logTable)
Get columns that have changed.
at line 668
array
getLogTableSpec()
Getter for logTableSpec.
at line 755
isEnabled()
Predicate whether logging is enabled.
at line 774
dropAllLogTables()
Drop all log tables.
This does not currently have a usage outside the tests.
at line 791
string
getNonStandardTableNameFilterString()
Get an sql clause to find the names of any log tables that do not match the normal pattern.
Most tables are civicrm_xxx with the log table being log_civicrm_xxx However, they don't have to match this pattern (e.g when defined by hook) so find the anomalies and return a filter string to include them.
at line 819
triggerInfo(array $info, null $tableName = NULL, bool $force = FALSE)
Get trigger info.
at line 920
static
disableLoggingForThisConnection()
Disable logging temporarily.
This allow logging to be temporarily disabled for certain cases where we want to do a mass cleanup but do not want to bother with an audit trail.
at line 932
getLogTablesForContact()
Get all the log tables that reference civicrm_contact.
Note that it might make sense to wrap this in a getLogTablesForEntity but this is the only entity currently available...