From 3e54c268abbfc637435b059c176eed27e0e7fab9 Mon Sep 17 00:00:00 2001 From: Uwe Tews Date: Mon, 20 Jul 2015 03:15:45 +0200 Subject: [PATCH] - bugfix config files got recompiled on each request --- change_log.txt | 3 +++ libs/Smarty.class.php | 4 ++-- .../smarty_internal_config_file_compiler.php | 14 ++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/change_log.txt b/change_log.txt index 46548c0d..52d1eaf9 100644 --- a/change_log.txt +++ b/change_log.txt @@ -1,4 +1,7 @@  ===== 3.1.28-dev===== (xx.xx.2015) + 20.07.2015 + - bugfix config files got recompiled on each request + 12.07.2015 - optimize {extends} compilation diff --git a/libs/Smarty.class.php b/libs/Smarty.class.php index a5ee9fd2..375e6d45 100644 --- a/libs/Smarty.class.php +++ b/libs/Smarty.class.php @@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase /** * smarty version */ - const SMARTY_VERSION = '3.1.28-dev/28'; + const SMARTY_VERSION = '3.1.28-dev/29'; /** * define variable scopes @@ -1419,7 +1419,7 @@ class Smarty extends Smarty_Internal_TemplateBase * Compile all config files * * @param string $extension file extension - * @param bool $force_compile force all to recompile + * @param bool $force_compile force all to recompile< * @param int $time_limit * @param int $max_errors * diff --git a/libs/sysplugins/smarty_internal_config_file_compiler.php b/libs/sysplugins/smarty_internal_config_file_compiler.php index fbde96e1..9e55b0cc 100644 --- a/libs/sysplugins/smarty_internal_config_file_compiler.php +++ b/libs/sysplugins/smarty_internal_config_file_compiler.php @@ -30,6 +30,7 @@ class Smarty_Internal_Config_File_Compiler * @var string */ public $parser_class; + /** * Lexer object * @@ -100,12 +101,15 @@ class Smarty_Internal_Config_File_Compiler public function compileTemplate(Smarty_Internal_Template $template) { $this->template = $template; - $this->template->properties['file_dependency'][$this->template->source->uid] = array($this->template->source->name, $this->template->source->getTimeStamp(), $this->template->source->type); + $this->template->properties['file_dependency'][$this->template->source->uid] = array($this->template->source->filepath, + $this->template->source->getTimeStamp(), + $this->template->source->type); if ($this->smarty->debugging) { Smarty_Internal_Debug::start_compile($this->template); } // init the lexer/parser to compile the config file - $lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . "\n", $this); + $lex = new $this->lexer_class(str_replace(array("\r\n", "\r"), "\n", $template->source->getContent()) . + "\n", $this); $parser = new $this->parser_class($lex, $this); if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) { @@ -135,10 +139,12 @@ class Smarty_Internal_Config_File_Compiler Smarty_Internal_Debug::end_compile($this->template); } // template header code - $template_header = "template->source->filepath . "\" */ ?>\n"; - $code = 'config_data, true) . '); ?>'; + $code = 'config_data, true) . '); ?>'; return $template_header . Smarty_Internal_Extension_CodeFrame::create($this->template, $code); }