From d938f496b2d944ee884e41d0b2d5f51806aca0fa Mon Sep 17 00:00:00 2001 From: Luciano Spiegel Date: Tue, 2 Jul 2019 12:30:10 +0200 Subject: [PATCH] expose smarty's compile_check to be overridden in civicrm.settings.php --- CRM/Core/Smarty.php | 12 ++++++++++++ .../CRM/common/civicrm.settings.php.template | 15 +++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/CRM/Core/Smarty.php b/CRM/Core/Smarty.php index bea2363ddd05..bef5152c5770 100644 --- a/CRM/Core/Smarty.php +++ b/CRM/Core/Smarty.php @@ -144,6 +144,8 @@ private function initialize() { $this->plugins_dir = [$smartyDir . 'plugins', $pluginsDir]; } + $this->compile_check = $this->isCheckSmartyIsCompiled(); + // add the session and the config here $session = CRM_Core_Session::singleton(); @@ -340,4 +342,14 @@ private function getLocale() { return 'en_US'; } + /** + * Get the compile_check value. + * + * @return bool + */ + private function isCheckSmartyIsCompiled() { + // check for define in civicrm.settings.php as FALSE, otherwise returns TRUE + return CRM_Utils_Constant::value('CIVICRM_TEMPLATE_COMPILE_CHECK', TRUE); + } + } diff --git a/templates/CRM/common/civicrm.settings.php.template b/templates/CRM/common/civicrm.settings.php.template index ec2fabbeb26c..c326ea4229d5 100644 --- a/templates/CRM/common/civicrm.settings.php.template +++ b/templates/CRM/common/civicrm.settings.php.template @@ -183,6 +183,21 @@ if (!defined('CIVICRM_TEMPLATE_COMPILEDIR')) { define( 'CIVICRM_TEMPLATE_COMPILEDIR', '%%templateCompileDir%%'); } +/** + * SMARTY Compile Check: + * + * This tells Smarty whether to check for recompiling or not. Recompiling + * does not need to happen unless a template or config file is changed. + * Typically you enable this during development, and disable for production. + * + * Related issue: + * https://lab.civicrm.org/dev/core/issues/1073 + * + */ +//if (!defined('CIVICRM_TEMPLATE_COMPILE_CHECK')) { +// define( 'CIVICRM_TEMPLATE_COMPILE_CHECK', FALSE); +//} + /** * Site URLs: *