Merge pull request #23587 from civicrm/5.50
[civicrm-core.git] / CRM / Upgrade / Incremental / General.php
index 3b95537b40fb9c26cba69aa12068bdc26133ceec..0f54db34bcd0db566c42c94e9d924ab29148c4e7 100644 (file)
@@ -129,6 +129,23 @@ class CRM_Upgrade_Incremental_General {
         2 => 'https://github.com/JMAConsulting/biz.jmaconsulting.financialaclreport',
       ]);
     }
+
+    $snapshotIssues = CRM_Upgrade_Snapshot::getActivationIssues();
+    if ($snapshotIssues) {
+      $preUpgradeMessage .= '<details>';
+      $preUpgradeMessage .= '<summary>' . ts('This upgrade will NOT use automatic snapshots.') . '</summary>';
+      $preUpgradeMessage .= '<p>' . ts('If an upgrade problem is discovered in the future, automatic snapshots may help recover. However, they also require additional storage and may not be available or appropriate in all configurations.') . '</p>';
+      $preUpgradeMessage .= ts('Here are the reasons why automatic snapshots are disabled:');
+      $preUpgradeMessage .= '<ul>' . implode("", array_map(
+          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>';
+    }
   }
 
   /**