mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 10:24:26 +02:00
new _clearTemplateCache() method
This commit is contained in:
@@ -1193,6 +1193,14 @@ class Smarty extends Smarty_Internal_TemplateBase
|
||||
return $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Empty template objects cache
|
||||
*/
|
||||
public function _clearTemplateCache() {
|
||||
$this->_cache['isCached'] = array();
|
||||
$this->_cache['tplObjects'] = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param boolean $compile_check
|
||||
*/
|
||||
|
@@ -207,15 +207,4 @@ abstract class Smarty_CacheResource
|
||||
// give up
|
||||
throw new SmartyException("Unable to load cache resource '{$type}'");
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalid Loaded Cache Files
|
||||
*
|
||||
* @param Smarty $smarty Smarty object
|
||||
*/
|
||||
public function invalidLoadedCache(Smarty $smarty)
|
||||
{
|
||||
$smarty->_cache['isCached'] = array();
|
||||
$smarty->_cache['tplObjects'] = array();
|
||||
}
|
||||
}
|
||||
|
@@ -32,9 +32,9 @@ class Smarty_Internal_Method_ClearAllCache
|
||||
*/
|
||||
public function clearAllCache(Smarty $smarty, $exp_time = null, $type = null)
|
||||
{
|
||||
$smarty->_clearTemplateCache();
|
||||
// load cache resource and call clearAll
|
||||
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
|
||||
$_cache_resource->invalidLoadedCache($smarty);
|
||||
return $_cache_resource->clearAll($smarty, $exp_time);
|
||||
}
|
||||
}
|
@@ -35,9 +35,9 @@ class Smarty_Internal_Method_ClearCache
|
||||
*/
|
||||
public function clearCache(Smarty $smarty, $template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
|
||||
{
|
||||
$smarty->_clearTemplateCache();
|
||||
// load cache resource and call clear
|
||||
$_cache_resource = Smarty_CacheResource::load($smarty, $type);
|
||||
$_cache_resource->invalidLoadedCache($smarty);
|
||||
return $_cache_resource->clear($smarty, $template_name, $cache_id, $compile_id, $exp_time);
|
||||
}
|
||||
}
|
@@ -33,6 +33,8 @@ class Smarty_Internal_Method_ClearCompiledTemplate
|
||||
*/
|
||||
public function clearCompiledTemplate(Smarty $smarty, $resource_name = null, $compile_id = null, $exp_time = null)
|
||||
{
|
||||
// clear template objects cache
|
||||
$smarty->_clearTemplateCache();
|
||||
|
||||
$_compile_dir = $smarty->getCompileDir();
|
||||
if ($_compile_dir == '/') { //We should never want to delete this!
|
||||
@@ -114,9 +116,6 @@ class Smarty_Internal_Method_ClearCompiledTemplate
|
||||
}
|
||||
}
|
||||
}
|
||||
// clear template objects cache
|
||||
$smarty->_cache['isCached'] = array();
|
||||
$smarty->_cache['tplObjects'] = array();
|
||||
return $_count;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user