Define experimental option CIVICRM_UPGRADE_SNAPSHOT
authorTim Otten <totten@civicrm.org>
Tue, 24 May 2022 05:10:39 +0000 (22:10 -0700)
committerTim Otten <totten@civicrm.org>
Tue, 24 May 2022 05:15:10 +0000 (22:15 -0700)
CRM/Upgrade/Incremental/General.php
CRM/Upgrade/Snapshot.php

index e8880665fe777570253d4946041edc48352ba8ae..0f54db34bcd0db566c42c94e9d924ab29148c4e7 100644 (file)
@@ -140,6 +140,10 @@ class CRM_Upgrade_Incremental_General {
           function($issue) {
             return sprintf('<li>%s</li>', $issue);
           }, $snapshotIssues)) . '</ul>';
+      $preUpgradeMessage .= '<p>' . ts('You may enable snapshots in "<code>%1</code>" by setting the experimental option "<code>%2</code>".', [
+        1 => 'civicrm.settings.php',
+        2 => htmlentities('define(\'CIVICRM_UPGRADE_SNAPSHOT\', TRUE)'),
+      ]) . '</p>';
       $preUpgradeMessage .= '</details>';
     }
   }
index fd52b602ff93a8ba4be572082e4fc9d9ddfde19e..5968ae54e0af42a4b329d9e791eabd8627002dc9 100644 (file)
@@ -40,7 +40,10 @@ class CRM_Upgrade_Snapshot {
    */
   public static function getActivationIssues(): array {
     if (static::$activationIssues === NULL) {
-      // TODO This policy should probably be more configurable, eg via `setting` or `define()`.
+      $policy = CRM_Utils_Constant::value('CIVICRM_UPGRADE_SNAPSHOT', 'auto');
+      if ($policy === TRUE) {
+        return [];
+      }
 
       $limits = [
         'civicrm_contact' => 200 * 1000,
@@ -71,6 +74,10 @@ class CRM_Upgrade_Snapshot {
       if (CRM_Core_I18n::isMultilingual()) {
         static::$activationIssues['multilingual'] = ts('Multilingual snapshots have not been implemented.');
       }
+
+      if ($policy === FALSE) {
+        static::$activationIssues['override'] = ts('Snapshots disabled by override (CIVICRM_UPGRADE_SNAPSHOT).');
+      }
     }
 
     return static::$activationIssues;