- enhancement an expire_time of -1 in clearCache() and clearAllCache() will delete outdated cache files

by their individual cache_lifetime used at creation (forum topic 24310)
This commit is contained in:
Uwe.Tews@googlemail.com
2013-05-26 10:50:13 +00:00
parent 6b5b06564f
commit 00c034b593
2 changed files with 258 additions and 245 deletions

View File

@@ -1,4 +1,8 @@
===== trunk =====
26.05.2013
- enhancement an expire_time of -1 in clearCache() and clearAllCache() will delete outdated cache files
by their individual cache_lifetime used at creation (forum topic 24310)
21.05.2013
- bugfix modifier strip_tags:true was compiled into wrong code (Forum Topic 24287)
- bugfix /n after ?> in Smarty.class.php did start output buffering (Issue 138)

View File

@@ -210,9 +210,18 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
}
}
// expired ?
if (isset($exp_time) && $_time - @filemtime($_file) < $exp_time) {
if (isset($exp_time)) {
if ($exp_time < 0) {
preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
if ($_time < (@filemtime($_file) + $match[1])) {
continue;
}
} else {
if ($_time - @filemtime($_file) < $exp_time) {
continue;
}
}
}
$_count += @unlink((string) $_file) ? 1 : 0;
}
}