optimizer의 캐시 타임 체크를 좀 더 세밀하게 변경

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3461 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-04 03:14:15 +00:00
parent 9a948ae5e5
commit 7354ed7e2b

View file

@ -101,9 +101,6 @@
$content_buff .= $str."\n"; $content_buff .= $str."\n";
} }
if($type == "css") $content_buff = '@charset "utf-8";'."\n".$content_buff; if($type == "css") $content_buff = '@charset "utf-8";'."\n".$content_buff;
if($type!="css" && Context::isGzEnabled()) $content_buff = ob_gzhandler($content_buff, 5);
$content_file = eregi_replace("\.php$","",$filename); $content_file = eregi_replace("\.php$","",$filename);
$content_filename = str_replace($this->cache_path, '', $content_file); $content_filename = str_replace($this->cache_path, '', $content_file);
@ -120,6 +117,7 @@
$unique = crc32($content_filename); $unique = crc32($content_filename);
$size = filesize($content_file); $size = filesize($content_file);
$mtime = filemtime($content_file); $mtime = filemtime($content_file);
$class_mtime = filemtime("./classes/optimizer/Optimizer.class.php");
$header_buff = '<?php $header_buff = '<?php
$content_filename = "'.$content_filename.'"; $content_filename = "'.$content_filename.'";
$mtime = '.$mtime.'; $mtime = '.$mtime.';
@ -140,14 +138,14 @@ header("Cache-Control: private, max-age=2592000");
header("Pragma: cache"); header("Pragma: cache");
header("Last-Modified: '.substr(gmdate('r', $mtime), 0, -5).'GMT"); header("Last-Modified: '.substr(gmdate('r', $mtime), 0, -5).'GMT");
header("ETag: '.dechex($unique).'-'.dechex($size).'-'.dechex($mtime).'"); header("ETag: '.dechex($unique).'-'.dechex($size).'-'.dechex($mtime).'");
if(!$cached && file_exists($content_filename)) { if(!$cached && time()>'.$class_mtime.' && file_exists($content_filename)) {
$buff = file_get_contents($content_filename); $buff = file_get_contents($content_filename);
//if($type != "css" && strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")!==false && function_exists("ob_gzhandler")) { if($type != "css" && strpos($_SERVER["HTTP_ACCEPT_ENCODING"], "gzip")!==false && function_exists("ob_gzhandler")) {
//header("Content-Encoding: gzip"); header("Content-Encoding: gzip");
//print ob_gzhandler($buff, 5); print ob_gzhandler($buff, 5);
//} else { } else {
print $buff; print $buff;
//} }
} }
exit(); exit();
?>'; ?>';