Skip to content

Commit

Permalink
Merge pull request #20541 from eileenmcnaughton/alpha_trigg
Browse files Browse the repository at this point in the history
Sort trigger data before processing
  • Loading branch information
seamuslee001 authored Jun 8, 2021
2 parents 94915ae + 9b0ff7e commit a6f6f86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CRM/Logging/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,9 @@ public function dropTriggers($tableName = NULL) {
$tableNames = $this->tables;
}

// Sort the table names so the sql output is consistent for those sites
// loading it asynchronously (using the setting 'logging_no_trigger_permission')
asort($tableNames);
foreach ($tableNames as $table) {
$validName = CRM_Core_DAO::shortenSQLName($table, 48, TRUE);

Expand Down
4 changes: 4 additions & 0 deletions Civi/Core/SqlTriggers.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ public function createTriggers($info, $onlyTableName = NULL) {
}
}

// Sort tables alphabetically in order to output in a consistent order
// for sites that like to diff this output over time
// (ie. with the logging_no_trigger_permission setting in place).
asort($triggers);
// now spit out the sql
foreach ($triggers as $tableName => $tables) {
if ($onlyTableName != NULL && $onlyTableName != $tableName) {
Expand Down

0 comments on commit a6f6f86

Please sign in to comment.