2009-03-22 16:09:05 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Smarty method Clear_All_Cache
|
|
|
|
*
|
|
|
|
* Empties the cache folder
|
|
|
|
*
|
|
|
|
* @package Smarty
|
|
|
|
* @subpackage SmartyMethod
|
|
|
|
* @author Uwe Tews
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
2009-08-08 17:28:23 +00:00
|
|
|
* Empty cache folder
|
2009-03-22 16:09:05 +00:00
|
|
|
*
|
2009-08-08 17:28:23 +00:00
|
|
|
* @param object $smarty
|
|
|
|
* @param integer $exp_time expiration time
|
|
|
|
* @param string $type resource type
|
|
|
|
* @return integer number of cache files deleted
|
2009-03-22 16:09:05 +00:00
|
|
|
*/
|
2009-08-08 17:28:23 +00:00
|
|
|
function clear_all_cache($smarty, $exp_time = null, $type = 'file')
|
|
|
|
{
|
|
|
|
// load cache resource
|
|
|
|
if (!isset($smarty->cache_resource_objects[$type])) {
|
|
|
|
$_cache_resource_class = 'Smarty_Internal_CacheResource_' . $type;
|
|
|
|
if (!$smarty->loadPlugin($_cache_resource_class)) {
|
|
|
|
throw new Exception("Undefined cache resource type {$type}");
|
2009-03-22 16:09:05 +00:00
|
|
|
}
|
2009-08-08 17:28:23 +00:00
|
|
|
$smarty->cache_resource_objects[$type] = new $_cache_resource_class($smarty);
|
2009-03-22 16:09:05 +00:00
|
|
|
}
|
2009-08-08 17:28:23 +00:00
|
|
|
|
|
|
|
return $smarty->cache_resource_objects[$type]->clearAll($exp_time);
|
2009-03-22 16:09:05 +00:00
|
|
|
}
|
2009-08-08 17:28:23 +00:00
|
|
|
|
2009-03-22 16:09:05 +00:00
|
|
|
?>
|