Merge pull request #374 from oldrind/template

修正模板缓存问题
This commit is contained in:
ThinkPHP
2016-03-12 10:56:06 +08:00
2 changed files with 11 additions and 11 deletions

View File

@@ -59,16 +59,16 @@ class File
*/
public function check($templates, $cacheFile, $cacheTime)
{
if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) {
// 缓存是否在有效期
return false;
}
foreach($templates as $time => $path) {
if (is_file($path) && filemtime($path) > $time + $cacheTime) {
if (is_file($path) && filemtime($path) > $time) {
// 模板文件如果有更新则缓存需要更新
return false;
}
}
if (0 != $cacheTime && time() > filemtime($cacheFile) + $cacheTime) {
// 缓存是否在有效期
return false;
}
return true;
}
}

View File

@@ -76,17 +76,17 @@ class Sae
*/
public function check($templates, $cacheFile, $cacheTime)
{
foreach($templates as $time => $path) {
if (is_file($path) && filemtime($path) > $time) {
// 模板文件如果有更新则缓存需要更新
return false;
}
}
$mtime = $this->get($cacheFile, 'mtime');
if (0 != $cacheTime && time() > $mtime + $cacheTime) {
// 缓存是否在有效期
return false;
}
foreach($templates as $time => $path) {
if (is_file($path) && filemtime($path) > $time + $cacheTime) {
// 模板文件如果有更新则缓存需要更新
return false;
}
}
return true;
}