FiveFortyNine - Fix guard on `changeBooleanColumnLimitTo()`
authorTim Otten <totten@civicrm.org>
Wed, 18 May 2022 21:58:42 +0000 (14:58 -0700)
committerTim Otten <totten@civicrm.org>
Thu, 19 May 2022 02:23:35 +0000 (19:23 -0700)
CRM/Upgrade/Incremental/php/FiveFortyNine.php

index ab0aa4a82ab509c1338b0e358db310895b0f716f..1573d3f8eef3645a604c9f73880fb7e97492c917 100644 (file)
@@ -80,11 +80,19 @@ class CRM_Upgrade_Incremental_php_FiveFortyNine extends CRM_Upgrade_Incremental_
   /**
    * Upgrade function.
    *
-   * @param string $rev
+   * @param string $currentRev
+   *   DB revision (which we are currently applying)
+   * @param string $startRev
+   *   DB revision (when the upgrade started)
+   * @param string $finalRev
+   *   DB revision (that we're aiming to reach, in the end)
    */
-  public function upgrade_5_49_0($rev) {
-    if (version_compare(CRM_Core_BAO_Domain::version(), '5.49.beta1', '>=')) {
-      $this->addtask('Revert civicrm_action_schedule.limit_to to be NULL', 'changeBooleanColumnLimitTo');
+  public function upgrade_5_49_2($currentRev, $startRev, $finalRev) {
+    if (empty($startRev)) {
+      throw new \RuntimeException("Error: Was somebody too clever about modifying the upgrader? We're missing a little-known but very-handy parameter!");
+    }
+    if (version_compare($startRev, '5.49.beta1', '>=')) {
+      $this->addTask('Revert civicrm_action_schedule.limit_to to be NULL', 'changeBooleanColumnLimitTo');
     }
   }