SqlTriggers
extends AutoService
in package
Class SqlTriggers
Tags
Table of Contents
Properties
- $enqueuedQueries : array<string|int, mixed>
- Queries written to file when the class is destructed.
- $file : string|null
- The name of the output file.
Methods
- __destruct() : mixed
- Write queries to file when the class is destructed.
- createTriggers() : mixed
- dropTriggers() : mixed
- Wrapper function to drop triggers.
- enqueueQuery() : mixed
- Enqueue a query which alters triggers.
- getFile() : null|string
- rebuild() : mixed
- Build a list of triggers via hook and add them to (err, reconcile them with) the database.
- writeEnqueuedQueriesToFile() : void
- Write queries queued for write-to-file.
Properties
$enqueuedQueries
Queries written to file when the class is destructed.
private
array<string|int, mixed>
$enqueuedQueries
= []
$file
The name of the output file.
private
string|null
$file
Methods
__destruct()
Write queries to file when the class is destructed.
public
__destruct() : mixed
Note this is already written out for a full rebuild but it is possible (at least in terms of what is public) to call drop & create separately so this ensures they are output.
createTriggers()
public
createTriggers(array<string|int, mixed> $info[, string $onlyTableName = NULL ]) : mixed
Parameters
- $info : array<string|int, mixed>
-
per hook_civicrm_triggerInfo.
- $onlyTableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
dropTriggers()
Wrapper function to drop triggers.
public
dropTriggers([string $tableName = NULL ]) : mixed
Parameters
- $tableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
enqueueQuery()
Enqueue a query which alters triggers.
public
enqueueQuery(string $triggerSQL[, array<string|int, mixed> $params = [] ]) : mixed
As this requires a high permission level we funnel the queries through here to facilitate them being taken 'offline'.
Parameters
- $triggerSQL : string
-
The sql to run to create or drop the triggers.
- $params : array<string|int, mixed> = []
-
Optional parameters to interpolate into the string.
getFile()
public
getFile() : null|string
Return values
null|stringrebuild()
Build a list of triggers via hook and add them to (err, reconcile them with) the database.
public
rebuild([string $tableName = NULL ][, bool $force = FALSE ]) : mixed
Parameters
- $tableName : string = NULL
-
the specific table requiring a rebuild; or NULL to rebuild all tables.
- $force : bool = FALSE
Tags
writeEnqueuedQueriesToFile()
Write queries queued for write-to-file.
protected
writeEnqueuedQueriesToFile() : void