mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
- 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:
@@ -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)
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
/**
|
||||
* Smarty Internal Plugin CacheResource File
|
||||
*
|
||||
* @package Smarty
|
||||
@@ -8,7 +8,7 @@
|
||||
* @author Rodney Rehm
|
||||
*/
|
||||
|
||||
/**
|
||||
/**
|
||||
* This class does contain all necessary methods for the HTML cache on file system
|
||||
*
|
||||
* Implements the file system as resource for the HTML cache Version ussing nocache inserts.
|
||||
@@ -16,7 +16,7 @@
|
||||
* @package Smarty
|
||||
* @subpackage Cacher
|
||||
*/
|
||||
class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
||||
class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
||||
|
||||
/**
|
||||
* populate Cached Object with meta data from Resource
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -261,6 +270,6 @@ class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
|
||||
$cached->is_locked = false;
|
||||
@unlink($cached->lock_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
Reference in New Issue
Block a user