mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-09 12:02:24 +09:00
r7451 보완
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7452 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
96b197c3a5
commit
5929e1ad4e
3 changed files with 13 additions and 7 deletions
|
|
@ -58,7 +58,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!count($targets)) return $this->_getOptimizedRemoved($files);
|
if(!count($targets)) return $this->_getOptimizedRemoved($files);
|
||||||
|
|
||||||
$list_file_hash = md5($hash);
|
$list_file_hash = md5($hash);
|
||||||
$oCacheHandler = &CacheHandler::getInstance('template');
|
$oCacheHandler = &CacheHandler::getInstance('template');
|
||||||
if($oCacheHandler->isSupport()){
|
if($oCacheHandler->isSupport()){
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,11 @@
|
||||||
|
|
||||||
$oCacheHandler = &CacheHandler::getInstance('template');
|
$oCacheHandler = &CacheHandler::getInstance('template');
|
||||||
if($oCacheHandler->isSupport()){
|
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){
|
if(!$buff){
|
||||||
$buff = $this->_compileTplFile($tpl_file);
|
$buff = $this->_compileTplFile($tpl_file);
|
||||||
$oCacheHandler->put('template:'.$tpl_file, $buff);
|
$oCacheHandler->put($cache_key, $buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $this->_fetch('', $buff, $tpl_path);
|
$output = $this->_fetch('', $buff, $tpl_path);
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ if($type == '.css'){
|
||||||
} else if($type == '.js') {
|
} else if($type == '.js') {
|
||||||
$content_type = 'text/javascript';
|
$content_type = 'text/javascript';
|
||||||
}
|
}
|
||||||
|
|
||||||
header("Content-Type: ".$content_type."; charset=UTF-8");
|
header("Content-Type: ".$content_type."; charset=UTF-8");
|
||||||
|
|
||||||
// return 304
|
// return 304
|
||||||
|
|
@ -82,6 +83,12 @@ function useContentEncoding(){
|
||||||
return false;
|
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){
|
function printFileList($list){
|
||||||
global $mtime, $cache_support, $oCacheHandler;
|
global $mtime, $cache_support, $oCacheHandler;
|
||||||
|
|
||||||
|
|
@ -89,7 +96,7 @@ function printFileList($list){
|
||||||
$output = null;
|
$output = null;
|
||||||
|
|
||||||
if($cache_support){
|
if($cache_support){
|
||||||
$cache_key = md5('optimized:'. join('',$list) . ($content_encoding?'gzip':'') );
|
$cache_key = getCacheKey($list);
|
||||||
$output = $oCacheHandler->get($cache_key, $mtime);
|
$output = $oCacheHandler->get($cache_key, $mtime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -225,7 +232,7 @@ if($type == '.js'){
|
||||||
$css[] = getRealPath($cache_file);
|
$css[] = getRealPath($cache_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache_key = md5('optimized:'. join('',$css) . ($content_encoding?'gzip':'') );
|
$cache_key = getCacheKey($css);
|
||||||
$buff = $oCacheHandler->get($cache_key, $mtime);
|
$buff = $oCacheHandler->get($cache_key, $mtime);
|
||||||
if(!$buff){
|
if(!$buff){
|
||||||
$buff = '';
|
$buff = '';
|
||||||
|
|
@ -238,7 +245,6 @@ if($type == '.js'){
|
||||||
$oCacheHandler->put($cache_key, $buff);
|
$oCacheHandler->put($cache_key, $buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
printFileList($css);
|
|
||||||
}else{
|
}else{
|
||||||
foreach($list as $file){
|
foreach($list as $file){
|
||||||
$cache_file = $cache_path . md5($file);
|
$cache_file = $cache_path . md5($file);
|
||||||
|
|
@ -252,8 +258,8 @@ if($type == '.js'){
|
||||||
$css[] = getRealPath($cache_file);
|
$css[] = getRealPath($cache_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
printFileList($css);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printFileList($css);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue