From fe8c33a31fbdfbbe5d02cdd59e63ff1bd86cae7b Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 27 Jan 2022 13:01:04 +1300 Subject: [PATCH] dev/core#2866 add pre-upgrade warning --- .../Incremental/php/FiveFortySeven.php | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/CRM/Upgrade/Incremental/php/FiveFortySeven.php b/CRM/Upgrade/Incremental/php/FiveFortySeven.php index 9317117d7a..398e91d87e 100644 --- a/CRM/Upgrade/Incremental/php/FiveFortySeven.php +++ b/CRM/Upgrade/Incremental/php/FiveFortySeven.php @@ -21,6 +21,27 @@ */ class CRM_Upgrade_Incremental_php_FiveFortySeven extends CRM_Upgrade_Incremental_Base { + /** + * Compute any messages which should be displayed before upgrade. + * + * Note: This function is called iteratively for each incremental upgrade step. + * There must be a concrete step (eg 'X.Y.Z.mysql.tpl' or 'upgrade_X_Y_Z()'). + * + * @param string $preUpgradeMessage + * @param string $rev + * a version number, e.g. '4.4.alpha1', '4.4.beta3', '4.4.0'. + * @param null $currentVer + */ + public function setPreUpgradeMessage(&$preUpgradeMessage, $rev, $currentVer = NULL): void { + if ($rev === '5.47.alpha1') { + $count = CRM_Core_DAO::singleValueQuery('SELECT count(*) FROM civicrm_contact WHERE preferred_mail_format != "Both"'); + if ($count) { + $preUpgradeMessage .= '

' . ts('The contact field preferred mail format is being phased out. Modern email clients can handle receiving both formats so CiviCRM is moving towards always sending both and the field will be incrementally removed from the UI.') + . ' ' . ts('See the issue for more detail') . '

'; + } + } + } + /** * Upgrade step; adds tasks including 'runSql'. * -- 2.25.1