From 4df4fb05b9346926c4893846d7920e93c48f053d Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 23 May 2022 22:10:39 -0700 Subject: [PATCH] Define experimental option CIVICRM_UPGRADE_SNAPSHOT --- CRM/Upgrade/Incremental/General.php | 4 ++++ CRM/Upgrade/Snapshot.php | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CRM/Upgrade/Incremental/General.php b/CRM/Upgrade/Incremental/General.php index e8880665fe..0f54db34bc 100644 --- a/CRM/Upgrade/Incremental/General.php +++ b/CRM/Upgrade/Incremental/General.php @@ -140,6 +140,10 @@ class CRM_Upgrade_Incremental_General { function($issue) { return sprintf('
  • %s
  • ', $issue); }, $snapshotIssues)) . ''; + $preUpgradeMessage .= '

    ' . ts('You may enable snapshots in "%1" by setting the experimental option "%2".', [ + 1 => 'civicrm.settings.php', + 2 => htmlentities('define(\'CIVICRM_UPGRADE_SNAPSHOT\', TRUE)'), + ]) . '

    '; $preUpgradeMessage .= ''; } } diff --git a/CRM/Upgrade/Snapshot.php b/CRM/Upgrade/Snapshot.php index fd52b602ff..5968ae54e0 100644 --- a/CRM/Upgrade/Snapshot.php +++ b/CRM/Upgrade/Snapshot.php @@ -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; -- 2.25.1