From 0d9fb7ebbeeaccb339843538b3a78215ec59b5f5 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Thu, 7 Dec 2023 17:25:29 +0000 Subject: [PATCH] Tweak Smarty messaging --- CRM/Utils/Check/Component/Smarty.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/CRM/Utils/Check/Component/Smarty.php b/CRM/Utils/Check/Component/Smarty.php index 947c344640..8e742c97d2 100644 --- a/CRM/Utils/Check/Component/Smarty.php +++ b/CRM/Utils/Check/Component/Smarty.php @@ -24,19 +24,24 @@ class CRM_Utils_Check_Component_Smarty extends CRM_Utils_Check_Component { * @return CRM_Utils_Check_Message[] */ public function checkSmarty3(): array { + $p = function($text) { + return '

' . $text . '

'; + }; + $messages = []; if (!defined('CIVICRM_SMARTY3_AUTOLOAD_PATH')) { - $smartyPath = rtrim(\Civi::paths()->getPath('[civicrm.packages]/'), '/') . DIRECTORY_SEPARATOR . 'smarty3/vendor/autoload.php'; + $smartyPath = \Civi::paths()->getPath('[civicrm.packages]/smarty3/vendor/autoload.php'); $messages[] = new CRM_Utils_Check_Message( __FUNCTION__, - ts('We are in the process of migrating from Smarty2 onto Smarty3 and then Smarty4 for performance and security reasons. ' - . 'As of CiviCRM 5.69 switching to Smarty3 is optional but recommended.' - . ' In order to switch you need to add the following to your civicrm.settings.php file: ') - . "
define('CIVICRM_SMARTY3_AUTOLOAD_PATH', '$smartyPath');
" - . ts('In some cases your extensions will not be compatible with Smarty 3 and will not have released compatible versions. ' - . ' Smarty2 will be supported in the ESR programme for at least another 6 months - '), - ts('Smarty3 recommended'), + $p(ts('CiviCRM is updating a major library (Smarty) to improve performance and security. In CiviCRM v5.69, the update is optional, but you should try it now.')) + . $p(ts('To apply the update, add this statement to civicrm.settings.php:')) + . sprintf("
  define('CIVICRM_SMARTY3_AUTOLOAD_PATH',\n    %s);
", htmlentities(var_export($smartyPath, 1))) + . $p('Some extensions may not work yet with Smarty v3. If you encounter problems, then simply remove the statement.') + . $p(ts('Upcoming versions will standardize on Smarty v3. CiviCRM v5.69-ESR will provide extended support for Smarty v2. To learn more and discuss, see the Smarty transition page.', [ + 1 => 'target="_blank" href="' . htmlentities('https://civicrm.org/esr') . '"', + 2 => 'target="_blank" href="' . htmlentities('https://civicrm.org/redirect/smarty-v3') . '"', + ])), + ts('Smarty Update (v2 => v3)'), LogLevel::WARNING, 'fa-lock' ); -- 2.25.1