From: Eileen McNaughton Date: Fri, 29 Oct 2021 01:06:39 +0000 (+1300) Subject: Use empty not isset in drop.tpl X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=61940bbfc430a264342967471dced0f948e2aef3;p=civicrm-core.git Use empty not isset in drop.tpl On experimenting a little with smarty escaping it turns out that isset is gonna be a lot more painful than empty - we should avoid where we can. In this case it is passed in as TRUE or not at all (from schema.tpl) so an empty check is just fine --- diff --git a/CRM/Core/CodeGen/Schema.php b/CRM/Core/CodeGen/Schema.php index 8a7cfb5822..7793dc5ae4 100644 --- a/CRM/Core/CodeGen/Schema.php +++ b/CRM/Core/CodeGen/Schema.php @@ -65,6 +65,7 @@ class CRM_Core_CodeGen_Schema extends CRM_Core_CodeGen_BaseTask { $dropOrder = array_reverse(array_keys($this->tables)); $template = new CRM_Core_CodeGen_Util_Template('sql'); $template->assign('dropOrder', $dropOrder); + $template->assign('isOutputLicense', TRUE); return ['civicrm_drop.mysql' => $template->fetch('drop.tpl')]; } diff --git a/xml/templates/drop.tpl b/xml/templates/drop.tpl index 9c53998656..92e98df8df 100644 --- a/xml/templates/drop.tpl +++ b/xml/templates/drop.tpl @@ -1,4 +1,4 @@ -{*suppress license if within a file that already has the license*}{if !isset($no_license) or !$no_license}-- +--------------------------------------------------------------------+ +{*suppress license if within a file that already has the license*}{if $isOutputLicense}-- +--------------------------------------------------------------------+ -- | Copyright CiviCRM LLC. All rights reserved. | -- | | -- | This work is published under the GNU AGPLv3 license with some | @@ -11,7 +11,7 @@ --{/if} -- /******************************************************* -- * --- * Clean up the existing tables{if isset($no_license) and $no_license} - this section generated from {$smarty.template} +-- * Clean up the existing tables{if !$isOutputLicense} - this section generated from {$smarty.template} {/if} -- * -- *******************************************************/ diff --git a/xml/templates/schema.tpl b/xml/templates/schema.tpl index d3e6189519..afb0192fc6 100644 --- a/xml/templates/schema.tpl +++ b/xml/templates/schema.tpl @@ -10,7 +10,7 @@ -- {$generated} --{if $database.comment} {$database.comment}{/if} -{include file="drop.tpl" no_license=TRUE} +{include file="drop.tpl" isOutputLicense=false} -- /******************************************************* -- *