From 65fcd69c4e4ba7832cf93c0ac35330d5bee44ec1 Mon Sep 17 00:00:00 2001 From: Kurund Jalmi Date: Tue, 15 Oct 2024 11:03:30 +0100 Subject: [PATCH] civix upgrade for smarty 5 --- info.xml | 4 ++-- ...v2@1.0.0.mixin.php => smarty-v2@1.0.1.mixin.php} | 13 ++++--------- 2 files changed, 6 insertions(+), 11 deletions(-) rename mixin/{smarty-v2@1.0.0.mixin.php => smarty-v2@1.0.1.mixin.php} (79%) diff --git a/info.xml b/info.xml index e9048ff..193c12e 100644 --- a/info.xml +++ b/info.xml @@ -14,7 +14,7 @@ https://github.com/systopia/de.systopia.xcm/issues https://www.gnu.org/licenses/agpl-3.0.html - + 1.14-dev dev @@ -33,7 +33,7 @@ mgd-php@1.0.0 menu-xml@1.0.0 setting-php@1.0.0 - smarty-v2@1.0.0 + smarty-v2@1.0.1 CRM_Xcm_Upgrader diff --git a/mixin/smarty-v2@1.0.0.mixin.php b/mixin/smarty-v2@1.0.1.mixin.php similarity index 79% rename from mixin/smarty-v2@1.0.0.mixin.php rename to mixin/smarty-v2@1.0.1.mixin.php index 0b37105..5972dbd 100644 --- a/mixin/smarty-v2@1.0.0.mixin.php +++ b/mixin/smarty-v2@1.0.1.mixin.php @@ -4,7 +4,7 @@ * Auto-register "templates/" folder. * * @mixinName smarty-v2 - * @mixinVersion 1.0.0 + * @mixinVersion 1.0.1 * @since 5.59 * * @param CRM_Extension_MixInfo $mixInfo @@ -19,14 +19,9 @@ } $register = function() use ($dir) { - // This implementation is useful for older versions of CiviCRM. It can be replaced/updated going forward (v1.1+). - $smarty = CRM_Core_Smarty::singleton(); - if (!is_array($smarty->template_dir)) { - $this->template_dir = [$smarty->template_dir]; - } - if (!in_array($dir, $smarty->template_dir)) { - array_unshift($smarty->template_dir, $dir); - } + // This implementation has a theoretical edge-case bug on older versions of CiviCRM where a template could + // be registered more than once. + CRM_Core_Smarty::singleton()->addTemplateDir($dir); }; // Let's figure out what environment we're in -- so that we know the best way to call $register().