mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- bugfix config files got recompiled on each request
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.28-dev===== (xx.xx.2015)
|
===== 3.1.28-dev===== (xx.xx.2015)
|
||||||
|
20.07.2015
|
||||||
|
- bugfix config files got recompiled on each request
|
||||||
|
|
||||||
12.07.2015
|
12.07.2015
|
||||||
- optimize {extends} compilation
|
- optimize {extends} compilation
|
||||||
|
|
||||||
|
@@ -111,7 +111,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.28-dev/28';
|
const SMARTY_VERSION = '3.1.28-dev/29';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -1419,7 +1419,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
* Compile all config files
|
* Compile all config files
|
||||||
*
|
*
|
||||||
* @param string $extension file extension
|
* @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 $time_limit
|
||||||
* @param int $max_errors
|
* @param int $max_errors
|
||||||
*
|
*
|
||||||
|
@@ -30,6 +30,7 @@ class Smarty_Internal_Config_File_Compiler
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
public $parser_class;
|
public $parser_class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lexer object
|
* Lexer object
|
||||||
*
|
*
|
||||||
@@ -100,12 +101,15 @@ class Smarty_Internal_Config_File_Compiler
|
|||||||
public function compileTemplate(Smarty_Internal_Template $template)
|
public function compileTemplate(Smarty_Internal_Template $template)
|
||||||
{
|
{
|
||||||
$this->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) {
|
if ($this->smarty->debugging) {
|
||||||
Smarty_Internal_Debug::start_compile($this->template);
|
Smarty_Internal_Debug::start_compile($this->template);
|
||||||
}
|
}
|
||||||
// init the lexer/parser to compile the config file
|
// 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);
|
$parser = new $this->parser_class($lex, $this);
|
||||||
|
|
||||||
if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
|
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);
|
Smarty_Internal_Debug::end_compile($this->template);
|
||||||
}
|
}
|
||||||
// template header code
|
// template header code
|
||||||
$template_header = "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
|
$template_header = "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " .
|
||||||
|
strftime("%Y-%m-%d %H:%M:%S") . "\n";
|
||||||
$template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
|
$template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
|
||||||
|
|
||||||
$code = '<?php Smarty_Internal_Extension_Config::loadConfigVars($_smarty_tpl, ' . var_export($this->config_data, true) . '); ?>';
|
$code = '<?php Smarty_Internal_Extension_Config::loadConfigVars($_smarty_tpl, ' .
|
||||||
|
var_export($this->config_data, true) . '); ?>';
|
||||||
return $template_header . Smarty_Internal_Extension_CodeFrame::create($this->template, $code);
|
return $template_header . Smarty_Internal_Extension_CodeFrame::create($this->template, $code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user