CRM_Logging_Schema
class CRM_Logging_Schema
Constants
ENGINE |
Default storage engine for log tables |
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 the engine config 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.
Retrieve missing log tables.
Details
at line 90
static bool
checkLoggingSupport(mixed $value, array $fieldSpec)
Setting Callback - Validate.
at line 112
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 129
__construct()
Populate $this->tables and $this->logs with current db state.
at line 197
customDataLogTables()
Return logging custom data tables.
at line 208
array
entityCustomDataLogTables(string $extends)
Return custom data tables for specified entity / extends.
at line 225
disableLogging()
Disable logging by dropping the triggers (but keep the log tables intact).
at line 242
dropTriggers(string $tableName = NULL)
Drop triggers for all logged tables.
at line 284
enableLogging()
Enable site-wide logging.
at line 294
fixSchemaDifferences(bool $enableLogging = FALSE)
Sync log tables and rebuild triggers.
at line 324
int
updateLogTableSchema(array $params)
Update log tables structure.
This function updates log tables to have the log_conn_id type of varchar and also implements the engine change defined by the hook (i.e. INNODB).
Note changing engine & adding hook-defined indexes, but not changing back to INNODB 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 379
string
getEngineForLogTable(string $table)
Get the engine for the given table.
at line 393
string
getEngineConfigForLogTable(string $table)
Get the engine config for the given table.
at line 407
array
getIndexesForTable(string $table)
Get all the indexes in the table.
at line 436
bool
fixSchemaDifferencesFor(string $table, array $cols = [])
Add missing (potentially specified) log table columns for the given table.
at line 531
fixSchemaDifferencesForAll(bool $rebuildTrigger = FALSE)
Fix schema differences.
at line 575
static 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 710
array
columnsWithDiffSpecs(string $civiTable, string $logTable)
Get columns that have changed.
at line 776
array
getLogTableSpec()
Getter for logTableSpec.
at line 870
isEnabled()
Predicate whether logging is enabled.
at line 889
dropAllLogTables()
Drop all log tables.
This does not currently have a usage outside the tests.
at line 906
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 934
triggerInfo(array $info, null $tableName = NULL, bool $force = FALSE)
Get trigger info.
at line 1046
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 1058
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...
at line 1068
array
getMissingLogTables()
Retrieve missing log tables.