dev/core#1618 Trigger a reconciliation of logging tables after Extension upgrades...
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 13 Aug 2021 22:09:18 +0000 (08:09 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Tue, 17 Aug 2021 01:49:40 +0000 (11:49 +1000)
Update PR as per comments from Dave D

CRM/Extension/Upgrades.php

index d26a266ff6e9d9fa254a5b9165c720708a60f95a..adf3b1f49493501cda107cf59bf5654b2b772694 100644 (file)
@@ -69,9 +69,27 @@ class CRM_Extension_Upgrades {
 
     CRM_Utils_Hook::upgrade('enqueue', $queue);
 
+    // dev/core#1618 When Extension Upgrades are run reconcile log tables
+    $task = new CRM_Queue_Task(
+      [__CLASS__, 'upgradeLogTables'],
+      [],
+      ts('Update log tables')
+    );
+    // Set weight low so that it will be run last.
+    $queue->createItem($task, -2);
+
     return $queue;
   }
 
+  /**
+   * Update log tables following execution of extension upgrades
+   */
+  public static function upgradeLogTables() {
+    $logging = new CRM_Logging_Schema();
+    $logging->fixSchemaDifferences();
+    return TRUE;
+  }
+
   /**
    * @return array
    *   Array(string $extKey => CRM_Extension_Upgrader_Interface $upgrader)