mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- bugfix for compile locking touched timestamp of old compiled file was not restored on compilation error https://github.com/smarty-php/smarty/issues/308
This commit is contained in:
@@ -1,4 +1,7 @@
|
|||||||
===== 3.1.31-dev ===== (xx.xx.xx)
|
===== 3.1.31-dev ===== (xx.xx.xx)
|
||||||
|
21.10.2016
|
||||||
|
- bugfix for compile locking touched timestamp of old compiled file was not restored on compilation error https://github.com/smarty-php/smarty/issues/308
|
||||||
|
|
||||||
20.10.2016
|
20.10.2016
|
||||||
- bugfix nocache code was not removed in cache file when subtemplate did contain PHP short tags in text but no other
|
- bugfix nocache code was not removed in cache file when subtemplate did contain PHP short tags in text but no other
|
||||||
nocache code https://github.com/smarty-php/smarty/issues/300
|
nocache code https://github.com/smarty-php/smarty/issues/300
|
||||||
|
@@ -114,7 +114,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
/**
|
/**
|
||||||
* smarty version
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.31-dev/37';
|
const SMARTY_VERSION = '3.1.31-dev/38';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
|
@@ -53,8 +53,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
}
|
}
|
||||||
// if use_sub_dirs, break file into directories
|
// if use_sub_dirs, break file into directories
|
||||||
if ($smarty->use_sub_dirs) {
|
if ($smarty->use_sub_dirs) {
|
||||||
$this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . $smarty->ds . $source->uid[ 2 ] . $source->uid[ 3 ] . $smarty->ds .
|
$this->filepath .= $source->uid[ 0 ] . $source->uid[ 1 ] . $smarty->ds . $source->uid[ 2 ] .
|
||||||
$source->uid[ 4 ] . $source->uid[ 5 ] . $smarty->ds;
|
$source->uid[ 3 ] . $smarty->ds . $source->uid[ 4 ] . $source->uid[ 5 ] . $smarty->ds;
|
||||||
}
|
}
|
||||||
$this->filepath .= $source->uid . '_';
|
$this->filepath .= $source->uid . '_';
|
||||||
if ($source->isConfig) {
|
if ($source->isConfig) {
|
||||||
@@ -62,7 +62,8 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
(int) $smarty->config_overwrite * 4;
|
(int) $smarty->config_overwrite * 4;
|
||||||
} else {
|
} else {
|
||||||
$this->filepath .= (int) $smarty->merge_compiled_includes + (int) $smarty->escape_html * 2 +
|
$this->filepath .= (int) $smarty->merge_compiled_includes + (int) $smarty->escape_html * 2 +
|
||||||
(($smarty->merge_compiled_includes && $source->type === 'extends') ? (int) $smarty->extends_recursion * 4 : 0);
|
(($smarty->merge_compiled_includes && $source->type === 'extends') ?
|
||||||
|
(int) $smarty->extends_recursion * 4 : 0);
|
||||||
}
|
}
|
||||||
$this->filepath .= '.' . $source->type;
|
$this->filepath .= '.' . $source->type;
|
||||||
$basename = $source->handler->getBasename($source);
|
$basename = $source->handler->getBasename($source);
|
||||||
@@ -192,12 +193,24 @@ class Smarty_Template_Compiled extends Smarty_Template_Resource_Base
|
|||||||
$this->nocache_hash = null;
|
$this->nocache_hash = null;
|
||||||
$this->unifunc = null;
|
$this->unifunc = null;
|
||||||
// compile locking
|
// compile locking
|
||||||
if ($saved_timestamp = $this->getTimeStamp()) {
|
$saved_timestamp = $_template->source->handler->recompiled ? false : $this->getTimeStamp();
|
||||||
|
if ($saved_timestamp) {
|
||||||
touch($this->filepath);
|
touch($this->filepath);
|
||||||
}
|
}
|
||||||
// call compiler
|
// compile locking
|
||||||
$_template->loadCompiler();
|
try {
|
||||||
$this->write($_template, $_template->compiler->compileTemplate($_template));
|
// call compiler
|
||||||
|
$_template->loadCompiler();
|
||||||
|
$this->write($_template, $_template->compiler->compileTemplate($_template));
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
// restore old timestamp in case of error
|
||||||
|
if ($saved_timestamp) {
|
||||||
|
touch($this->filepath, $saved_timestamp);
|
||||||
|
}
|
||||||
|
unset($_template->compiler);
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
// release compiler object to free memory
|
// release compiler object to free memory
|
||||||
unset($_template->compiler);
|
unset($_template->compiler);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user