r7451 보완

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7452 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2010-05-12 09:43:33 +00:00
parent 96b197c3a5
commit 5929e1ad4e
3 changed files with 13 additions and 7 deletions

View file

@ -58,7 +58,6 @@
}
if(!count($targets)) return $this->_getOptimizedRemoved($files);
$list_file_hash = md5($hash);
$oCacheHandler = &CacheHandler::getInstance('template');
if($oCacheHandler->isSupport()){

View file

@ -57,10 +57,11 @@
$oCacheHandler = &CacheHandler::getInstance('template');
if($oCacheHandler->isSupport()){
$buff = $oCacheHandler->get('template:'.$tpl_file, filemtime(FileHandler::getRealPath($tpl_file)));
$cache_key = 'template:'.$_SERVER['HTTP_HOST'] . $tpl_file;
$buff = $oCacheHandler->get($cache_key, filemtime(FileHandler::getRealPath($tpl_file)));
if(!$buff){
$buff = $this->_compileTplFile($tpl_file);
$oCacheHandler->put('template:'.$tpl_file, $buff);
$oCacheHandler->put($cache_key, $buff);
}
$output = $this->_fetch('', $buff, $tpl_path);

View file

@ -60,6 +60,7 @@ if($type == '.css'){
} else if($type == '.js') {
$content_type = 'text/javascript';
}
header("Content-Type: ".$content_type."; charset=UTF-8");
// return 304
@ -82,6 +83,12 @@ function useContentEncoding(){
return false;
}
function getCacheKey($list){
global $cache_support;
$content_encoding = useContentEncoding();
return md5('optimized:' . $_SERVER['HTTP_HOST'] . ':' . join('',$list) . ($content_encoding?'gzip':'') );
}
function printFileList($list){
global $mtime, $cache_support, $oCacheHandler;
@ -89,7 +96,7 @@ function printFileList($list){
$output = null;
if($cache_support){
$cache_key = md5('optimized:'. join('',$list) . ($content_encoding?'gzip':'') );
$cache_key = getCacheKey($list);
$output = $oCacheHandler->get($cache_key, $mtime);
}
@ -225,7 +232,7 @@ if($type == '.js'){
$css[] = getRealPath($cache_file);
}
$cache_key = md5('optimized:'. join('',$css) . ($content_encoding?'gzip':'') );
$cache_key = getCacheKey($css);
$buff = $oCacheHandler->get($cache_key, $mtime);
if(!$buff){
$buff = '';
@ -238,7 +245,6 @@ if($type == '.js'){
$oCacheHandler->put($cache_key, $buff);
}
printFileList($css);
}else{
foreach($list as $file){
$cache_file = $cache_path . md5($file);
@ -252,8 +258,8 @@ if($type == '.js'){
$css[] = getRealPath($cache_file);
}
printFileList($css);
}
printFileList($css);
}
?>