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
|
19.11.2016
|
||||||
- bugfix inheritance root child templates containing nested {block}{/block} could call sub-bock content from parent
|
- 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
|
template https://github.com/smarty-php/smarty/issues/317
|
||||||
|
- change version checking
|
||||||
|
|
||||||
11.11.2016
|
11.11.2016
|
||||||
- bugfix when Smarty is using a cached template object on Smarty::fetch() or Smarty::isCached() the inheritance data
|
- 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
|
* smarty version
|
||||||
*/
|
*/
|
||||||
const SMARTY_VERSION = '3.1.31-dev/45';
|
const SMARTY_VERSION = '3.1.31-dev/46';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* define variable scopes
|
* define variable scopes
|
||||||
@@ -1008,9 +1008,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
if (!$this->_compileDirNormalized) {
|
if (!$this->_compileDirNormalized) {
|
||||||
$this->_normalizeDir('compile_dir', $this->compile_dir);
|
$this->_normalizeDir('compile_dir', $this->compile_dir);
|
||||||
$this->_compileDirNormalized = true;
|
$this->_compileDirNormalized = true;
|
||||||
if ($this->_isNewRelease($this->compile_dir)) {
|
|
||||||
$this->clearCompiledTemplate();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->compile_dir;
|
return $this->compile_dir;
|
||||||
}
|
}
|
||||||
@@ -1039,9 +1036,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
if (!$this->_cacheDirNormalized) {
|
if (!$this->_cacheDirNormalized) {
|
||||||
$this->_normalizeDir('cache_dir', $this->cache_dir);
|
$this->_normalizeDir('cache_dir', $this->cache_dir);
|
||||||
$this->_cacheDirNormalized = true;
|
$this->_cacheDirNormalized = true;
|
||||||
if ($this->_isNewRelease($this->cache_dir)) {
|
|
||||||
$this->clearAllCache();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return $this->cache_dir;
|
return $this->cache_dir;
|
||||||
}
|
}
|
||||||
@@ -1258,23 +1252,6 @@ class Smarty extends Smarty_Internal_TemplateBase
|
|||||||
$this->_cache[ 'tplObjects' ] = array();
|
$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
|
* 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)
|
public function _decodeProperties(Smarty_Internal_Template $tpl, $properties, $cache = false)
|
||||||
{
|
{
|
||||||
// on cache resources other than file check version stored in cache code
|
// on cache resources other than file check version stored in cache code
|
||||||
if ($cache && $tpl->smarty->caching_type !== 'file' && Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
|
if (!isset($properties[ 'version' ]) || Smarty::SMARTY_VERSION !== $properties[ 'version' ]) {
|
||||||
$tpl->smarty->clearAllCache();
|
if ($cache) {
|
||||||
|
$tpl->smarty->clearAllCache();
|
||||||
|
} else {
|
||||||
|
$tpl->smarty->clearCompiledTemplate();
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$is_valid = true;
|
$is_valid = true;
|
||||||
if (!empty($properties[ 'file_dependency' ]) &&
|
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
|
// check file dependencies at compiled code
|
||||||
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
foreach ($properties[ 'file_dependency' ] as $_file_to_check) {
|
||||||
|
Reference in New Issue
Block a user