mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
- change version checking
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
19.11.2016
|
||||
- bugfix inheritance root child templates containing nested {block}{/block} could call sub-bock content from parent
|
||||
template https://github.com/smarty-php/smarty/issues/317
|
||||
- change version checking
|
||||
|
||||
11.11.2016
|
||||
- bugfix when Smarty is using a cached template object on Smarty::fetch() or Smarty::isCached() the inheritance data
|
||||
|
@@ -108,7 +108,7 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
/**
|
||||
* smarty version
|
||||
*/
|
||||
const SMARTY_VERSION = '3.1.31-dev/45';
|
||||
const SMARTY_VERSION = '3.1.31-dev/46';
|
||||
|
||||
/**
|
||||
* define variable scopes
|
||||
@@ -1008,9 +1008,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
if (!$this->_compileDirNormalized) {
|
||||
$this->_normalizeDir('compile_dir', $this->compile_dir);
|
||||
$this->_compileDirNormalized = true;
|
||||
if ($this->_isNewRelease($this->compile_dir)) {
|
||||
$this->clearCompiledTemplate();
|
||||
}
|
||||
}
|
||||
return $this->compile_dir;
|
||||
}
|
||||
@@ -1039,9 +1036,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
if (!$this->_cacheDirNormalized) {
|
||||
$this->_normalizeDir('cache_dir', $this->cache_dir);
|
||||
$this->_cacheDirNormalized = true;
|
||||
if ($this->_isNewRelease($this->cache_dir)) {
|
||||
$this->clearAllCache();
|
||||
}
|
||||
}
|
||||
return $this->cache_dir;
|
||||
}
|
||||
@@ -1258,23 +1252,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
$this->_cache[ 'tplObjects' ] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* check if new release was installed
|
||||
*
|
||||
* @param string $dir compiled oder cache dir path
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function _isNewRelease($dir)
|
||||
{
|
||||
if (!is_file($file = $dir . preg_replace('#[^a-zA-Z0-9.-]#', '.', Smarty::SMARTY_VERSION) . 'version.txt')) {
|
||||
file_put_contents($file, Smarty::SMARTY_VERSION);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Smarty object
|
||||
*
|
||||
|
@@ -420,13 +420,17 @@ class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
|
||||
public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
|
||||
{
|
||||
// on cache resources other than file check version stored in cache code
|
||||
if ($cache && $tpl->smarty->caching_type !== 'file' && Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
|
||||
$tpl->smarty->clearAllCache();
|
||||
if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
|
||||
if ($cache) {
|
||||
$tpl->smarty->clearAllCache();
|
||||
} else {
|
||||
$tpl->smarty->clearCompiledTemplate();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
$is_valid = true;
|
||||
if (!empty($properties[ 'file_dependency' ]) &&
|
||||
((!$cache && $tpl->smarty->compile_check) || $tpl->smarty->compile_check == 1)
|
||||
((!$cache && $tpl->smarty->compile_check) || $tpl->smarty->compile_check == 1)
|
||||
) {
|
||||
// check file dependencies at compiled code
|
||||
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
||||
|
Reference in New Issue
Block a user