외부페이지 모듈의 캐시파일 자동 삭제 기능 정상적으로 동작하도록 코드 수정 + 서버내 파일 include시 대상 파일의 include까지 모두 처리후 제로보드XE의 템플릿 사용할 수 있도록 기능 개선

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@2647 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2007-09-28 04:53:48 +00:00
parent 1aee7c7b60
commit dbfb9b34fb
2 changed files with 27 additions and 13 deletions

View file

@ -70,7 +70,7 @@
$oModuleController->updateModuleGrant($module_info->module_srl, $grants);
// 캐시 파일 삭제
$cache_file = sprintf("./files/cache/opage/%d.cache", $module_info->module_srl);
$cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl);
if(file_exists($cache_file)) @unlink($cache_file);
// 등록 성공후 return될 메세지 정리

View file

@ -91,15 +91,28 @@
* @brief 내부 파일일 경우 include하도록 캐시파일을 만들고 처리
**/
function executeFile($path, $caching_interval, $cache_file) {
// 파일이 없으면 취소
if(!file_exists($path)) return;
// 경로와 파일이름을 구함
$tmp_path = explode('/',$cache_file);
$filename = $tmp_path[count($tmp_path)-1];
$filepath = ereg_replace($filename."$","",$cache_file);
// 캐시 검사
if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time()) {
if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file)<filemtime($path) ) {
if(file_exists($cache_file)) @unlink($cache_file);
// 경로와 파일이름을 구함
$tmp_path = explode('/',$path);
$filename = $tmp_path[count($tmp_path)-1];
$filepath = ereg_replace($filename."$","",$path);
// 일단 대상 파일을 읽어서 내용을 구함
ob_start();
@include($path);
$content = ob_get_contents();
ob_end_clean();
FileHandler::writeFile($cache_file, $content);
// include후 결과를 return
if(!file_exists($cache_file)) return;
// 컴파일 시도
$oTemplate = &TemplateHandler::getInstance();
@ -108,13 +121,14 @@
FileHandler::writeFile($cache_file, $script);
}
// include후 결과를 return
if(file_exists($cache_file)) {
ob_start();
@include($cache_file);
$content = ob_get_contents();
ob_end_clean();
}
$__Context = &$GLOBALS['__Context__'];
$__Context->tpl_path = $filepath;
if($_SESSION['is_logged']) $__Context->logged_info = $_SESSION['logged_info'];
ob_start();
@include($cache_file);
$content = ob_get_contents();
ob_end_clean();
return $content;
}