#18910823 캐쉬파일 재생성시 디렉토리 삭제 및 cache truncate 실행

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7485 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2010-05-26 00:50:34 +00:00
parent fdb236d0d1
commit 19497e2837
11 changed files with 39 additions and 6 deletions

View file

@ -22,13 +22,18 @@
* @return none
**/
function procAdminRecompileCacheFile() {
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
// rename cache dir
$temp_cache_dir = './files/cache_'. time();
FileHandler::rename('./files/cache', $temp_cache_dir);
FileHandler::makeDir('./files/cache');
// remove debug files
FileHandler::removeFile(_XE_PATH_.'files/_debug_message.php');
FileHandler::removeFile(_XE_PATH_.'files/_debug_db_query.php');
FileHandler::removeFile(_XE_PATH_.'files/_db_slow_query.php');
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
// call recompileCache for each module
foreach($module_list as $module) {
@ -37,6 +42,25 @@
if(method_exists($oModule, 'recompileCache')) $oModule->recompileCache();
}
// remove cache dir
FileHandler::removeDir($temp_cache_dir);
$truncated = array();
$oObjectCacheHandler = &CacheHandler::getInstance();
$oTemplateCacheHandler = &CacheHandler::getInstance('template');
if($oObjectCacheHandler->isSupport()){
$truncated[] = $oObjectCacheHandler->truncate();
}
if($oTemplateCacheHandler->isSupport()){
$truncated[] = $oTemplateCacheHandler->truncate();
}
if(count($truncated) && in_array(false,$truncated)){
return new Object(-1,'msg_self_restart_cache_engine');
}
$this->setMessage('success_updated');
}
@ -51,4 +75,4 @@
header('Location: '.getUrl('module','admin','act',''));
}
}
?>
?>