mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-04 01:01:41 +09:00
캐시를 지우는 외부 툴 스크립트 추가. 파일을 핸들링할때 경로를 제대로 찾아서 처리할 수 있도록 코드 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4331 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5d19990111
commit
bdc194ab1d
41 changed files with 246 additions and 95 deletions
|
|
@ -12,6 +12,7 @@ RewriteRule ^(.+)/common/tpl/(.*) ./common/tpl/$2 [L]
|
|||
RewriteRule ^(.+)/widgets/(.*) ./widgets/$2 [L]
|
||||
RewriteRule ^(.+)/layouts/(.*) ./layouts/$2 [L]
|
||||
RewriteRule ^(.+)/addons/(.*) ./addons/$2 [L]
|
||||
RewriteRule ^(.+)/tools/(.*) ./tools/$2 [L]
|
||||
|
||||
# page
|
||||
RewriteRule ^([a-zA-Z0-9_]+)/([[:digit:]]+)page$ ./index.php?mid=$1&page=$2 [L]
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@
|
|||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
|
||||
if(file_exists($flag_file)) {
|
||||
@unlink($flag_file);
|
||||
FileHandler::removeFile($flag_file);
|
||||
Context::loadLang('./addons/member_communication/lang');
|
||||
|
||||
$script = sprintf('<script type="text/javascript"> xAddEventListener(window,"load", function() {if(confirm("%s")) { popopen("%s"); }}); </script>', Context::getLang('alert_new_message_arrived'), Context::getRequestUri().'?module=communication&act=dispCommunicationNewMessage');
|
||||
|
|
|
|||
|
|
@ -185,6 +185,14 @@
|
|||
if(is_object($oDB)&&method_exists($oDB, 'close')) $oDB->close();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DB의 및 기타 정보 load
|
||||
**/
|
||||
function loadDBInfo() {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_loadDBInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief DB 정보를 설정하고 DB Type과 DB 정보를 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -496,7 +496,7 @@
|
|||
if(!is_array($tables)) $tables = array($tables);
|
||||
foreach($tables as $alias => $table) {
|
||||
$filename = sprintf('%s/cache.%s%s', $this->count_cache_path, $this->prefix, $table);
|
||||
@unlink($filename);
|
||||
FileHandler::removeFile($filename);
|
||||
FileHandler::writeFile( $filename, '' );
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -9,10 +9,21 @@
|
|||
|
||||
class FileHandler extends Handler {
|
||||
|
||||
/**
|
||||
* @brief 대상 파일이름이나 디렉토리의 위치를 확인함
|
||||
**/
|
||||
function getRealPath($source) {
|
||||
if(substr($source,0,1)=='/') return $source;
|
||||
if(substr($source,0,2)=='./') $source = substr($source,2);
|
||||
return _XE_PATH_.$source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 파일의 내용을 읽어서 return
|
||||
**/
|
||||
function readFile($file_name) {
|
||||
$file_name = FileHandler::getRealPath($file_name);
|
||||
|
||||
if(!file_exists($file_name)) return;
|
||||
$filesize = filesize($file_name);
|
||||
if($filesize<1) return;
|
||||
|
|
@ -35,6 +46,8 @@
|
|||
* @brief $buff의 내용을 파일에 쓰기
|
||||
**/
|
||||
function writeFile($file_name, $buff, $mode = "w") {
|
||||
$file_name = FileHandler::getRealPath($file_name);
|
||||
|
||||
$pathinfo = pathinfo($file_name);
|
||||
$path = $pathinfo['dirname'];
|
||||
if(!is_dir($path)) FileHandler::makeDir($path);
|
||||
|
|
@ -47,38 +60,58 @@
|
|||
@chmod($file_name, 0644);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 파일 삭제
|
||||
**/
|
||||
function removeFile($file_name) {
|
||||
$file_name = FileHandler::getRealPath($file_name);
|
||||
if(file_exists($file_name)) @unlink($file_name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 파일이름이나 디렉토리명이나 위치 변경
|
||||
**/
|
||||
function rename($source, $target) {
|
||||
$source = FileHandler::getRealPath($source);
|
||||
$target = FileHandler::getRealPath($target);
|
||||
@rename($source, $target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 특정 디렉토리를 이동
|
||||
**/
|
||||
function moveDir($source_dir, $target_dir) {
|
||||
if(!is_dir($source_dir)) return;
|
||||
|
||||
if(!is_dir($target_dir)) {
|
||||
FileHandler::makeDir($target_dir);
|
||||
@unlink($target_dir);
|
||||
}
|
||||
|
||||
@rename($source_dir, $target_dir);
|
||||
FileHandler::rename($source_dir, $target_dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief $path내의 파일들을 return ('.', '..', '.로 시작하는' 파일들은 제외)
|
||||
**/
|
||||
function readDir($path, $filter = '', $to_lower = false, $concat_prefix = false) {
|
||||
$path = FileHandler::getRealPath($path);
|
||||
|
||||
if(substr($path,-1)!='/') $path .= '/';
|
||||
if(!is_dir($path)) return array();
|
||||
|
||||
$oDir = dir($path);
|
||||
while($file = $oDir->read()) {
|
||||
if(substr($file,0,1)=='.') continue;
|
||||
|
||||
if($filter && !preg_match($filter, $file)) continue;
|
||||
|
||||
if($to_lower) $file = strtolower($file);
|
||||
|
||||
if($filter) $file = preg_replace($filter, '$1', $file);
|
||||
else $file = $file;
|
||||
|
||||
if($concat_prefix) $file = $path.$file;
|
||||
if($concat_prefix) {
|
||||
$file = sprintf('%s%s', str_replace(_XE_PATH_, '', $path), $file);
|
||||
}
|
||||
|
||||
$output[] = $file;
|
||||
}
|
||||
if(!$output) return array();
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
|
@ -108,6 +141,7 @@
|
|||
* @brief 지정된 디렉토리 이하 모두 파일을 삭제
|
||||
**/
|
||||
function removeDir($path) {
|
||||
$path = FileHandler::getRealPath($path);
|
||||
if(!is_dir($path)) return;
|
||||
$directory = dir($path);
|
||||
while($entry = $directory->read()) {
|
||||
|
|
@ -145,6 +179,8 @@
|
|||
* @brief 원격파일을 다운받아서 특정 위치에 저장
|
||||
**/
|
||||
function getRemoteFile($url, $target_filename) {
|
||||
$target_filename = FileHandler::getRealPath($target_filename);
|
||||
|
||||
$url_info = parse_url($url);
|
||||
|
||||
if(!$url_info['port']) $url_info['port'] = 80;
|
||||
|
|
@ -191,6 +227,9 @@
|
|||
* @brief 특정 이미지 파일을 특정 위치로 옮김 (옮길때 이미지의 크기를 리사이징할 수 있음..)
|
||||
**/
|
||||
function createImageFile($source_file, $target_file, $resize_width = 0, $resize_height = 0, $target_type = '', $thumbnail_type = 'crop') {
|
||||
$source_file = FileHandler::getRequestUri($source_file);
|
||||
$target_file = FileHandler::getRequestUri($target_file);
|
||||
|
||||
if(!file_exists($source_file)) return;
|
||||
if(!$resize_width) $resize_width = 100;
|
||||
if(!$resize_height) $resize_height = $resize_width;
|
||||
|
|
|
|||
|
|
@ -45,17 +45,17 @@
|
|||
if(!$tpl_file) $tpl_file = $tpl_path.$tpl_filename;
|
||||
|
||||
// tpl_file이 비어 있거나 해당 파일이 없으면 return
|
||||
if(!$tpl_file || !file_exists($tpl_file)) return;
|
||||
if(!$tpl_file || !file_exists(FileHandler::getRealPath($tpl_file))) return;
|
||||
|
||||
$this->tpl_path = $tpl_path;
|
||||
$this->tpl_file = $tpl_file;
|
||||
|
||||
// compiled된(or 될) 파일이름을 구함
|
||||
$compiled_tpl_file = $this->_getCompiledFileName($tpl_file);
|
||||
$compiled_tpl_file = FileHandler::getRealPath($this->_getCompiledFileName($tpl_file));
|
||||
|
||||
// 일단 컴파일
|
||||
$buff = $this->_compile($tpl_file, $compiled_tpl_file);
|
||||
|
||||
|
||||
// Context와 compiled_tpl_file로 컨텐츠 생성
|
||||
$output = $this->_fetch($compiled_tpl_file, $buff, $tpl_path);
|
||||
|
||||
|
|
@ -83,9 +83,9 @@
|
|||
function _compile($tpl_file, $compiled_tpl_file) {
|
||||
if(!file_exists($compiled_tpl_file)) return $this->_compileTplFile($tpl_file, $compiled_tpl_file);
|
||||
|
||||
$source_ftime = filemtime($tpl_file);
|
||||
$source_ftime = filemtime(FileHandler::getRealPath($tpl_file));
|
||||
$target_ftime = filemtime($compiled_tpl_file);
|
||||
if($source_ftime>$target_ftime || $target_ftime < filemtime('./classes/template/TemplateHandler.class.php') ) return $this->_compileTplFile($tpl_file, $compiled_tpl_file);
|
||||
if($source_ftime>$target_ftime || $target_ftime < filemtime(_XE_PATH_.'classes/template/TemplateHandler.class.php') ) return $this->_compileTplFile($tpl_file, $compiled_tpl_file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@
|
|||
FileHandler::writeFile($cache_file, $widget_content);
|
||||
|
||||
// lock 파일 제거
|
||||
@unlink($lock_file);
|
||||
FileHandler::removeFile($lock_file);
|
||||
|
||||
return $widget_content;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -472,8 +472,13 @@
|
|||
* 현재 요청받은 스크립트 경로를 return
|
||||
**/
|
||||
function getScriptPath() {
|
||||
$url = $_SERVER['PHP_SELF']?$_SERVER['PHP_SELF']:($_SERVER['REQUEST_URI']?$_SERVER['REQUEST_URI']:$_SERVER['URL']);
|
||||
return preg_replace('/index.php/i','',$url);
|
||||
static $url = null;
|
||||
if($url === null) {
|
||||
$document_root = str_replace('\\','/',$_SERVER['DOCUMENT_ROOT']);
|
||||
$file = str_replace('\\','/',__FILE__);
|
||||
$url = preg_replace('/index.php/i','',str_replace('config/func.inc.php','',str_replace($document_root, '', $file)));
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -46,9 +46,9 @@
|
|||
FileHandler::removeFilesInDir("./files/cache/queries");
|
||||
|
||||
// ./files/cache/news* 파일 삭제
|
||||
$directory = dir("./files/cache/");
|
||||
$directory = dir(_XE_PATH_."files/cache/");
|
||||
while($entry = $directory->read()) {
|
||||
if(substr($entry,0,11)=='newest_news') @unlink("./files/cache/".$entry);
|
||||
if(substr($entry,0,11)=='newest_news') FileHandler::removeFile("./files/cache/".$entry);
|
||||
}
|
||||
$directory->close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@
|
|||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y') {
|
||||
@unlink($module_info->{$vars->name});
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @brief comment 모듈의 high class
|
||||
**/
|
||||
|
||||
require_once('./modules/comment/comment.item.php');
|
||||
require_once(_XE_PATH_.'modules/comment/comment.item.php');
|
||||
|
||||
class comment extends ModuleObject {
|
||||
|
||||
|
|
|
|||
|
|
@ -285,7 +285,7 @@
|
|||
}
|
||||
|
||||
// 성공시 lock파일 제거
|
||||
@unlink($lock_file);
|
||||
FileHandler::removeFile($lock_file);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@
|
|||
// 플래그 삭제
|
||||
$flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
|
||||
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||
@unlink($flag_file);
|
||||
FileHandler::removeFile($flag_file);
|
||||
|
||||
$this->setTemplateFile('new_message');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@
|
|||
$this->deleteThumbnailFile($path."/".$entry);
|
||||
} else {
|
||||
if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue;
|
||||
@unlink($path.'/'.$entry);
|
||||
FileHandler::removeFile($path.'/'.$entry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
* @brief document 모듈의 high 클래스
|
||||
**/
|
||||
|
||||
require_once('./modules/document/document.item.php');
|
||||
require_once(_XE_PATH_.'modules/document/document.item.php');
|
||||
|
||||
class document extends ModuleObject {
|
||||
|
||||
|
|
@ -31,7 +31,7 @@
|
|||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||
$oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
|
||||
$oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
|
||||
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
|
||||
|
||||
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
|
||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||
|
|
@ -182,30 +182,27 @@
|
|||
**/
|
||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||
|
||||
// 2008. 04. 23 blamed count 컬럼 추가
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count"))
|
||||
{
|
||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
// 2008. 04. 23 blamed count 컬럼 추가
|
||||
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count"))
|
||||
{
|
||||
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
|
||||
}
|
||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) {
|
||||
$oDB->addIndex('documents', 'idx_module_blamed_count', array('module_srl', 'blamed_count'));
|
||||
}
|
||||
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point"))
|
||||
$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
|
||||
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
if(!$oDB->isColumnExists("document_voted_log", "point"))
|
||||
$oDB->addColumn('document_voted_log', 'point', 'number', 11, 0, true);
|
||||
return new Object(0,'success_updated');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 캐시 파일 재생성
|
||||
**/
|
||||
function recompileCache() {
|
||||
// 게시글 분류 캐시 파일 삭제
|
||||
FileHandler::removeFilesInDir("./files/cache/document_category");
|
||||
FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -762,8 +762,8 @@
|
|||
$category_list = $output->data;
|
||||
|
||||
if(!$category_list) {
|
||||
@unlink($xml_file);
|
||||
@unlink($php_file);
|
||||
FileHandler::removeFile($xml_file);
|
||||
FileHandler::removeFile($php_file);
|
||||
return false;
|
||||
}
|
||||
if(!is_array($category_list)) $category_list = array($category_list);
|
||||
|
|
|
|||
|
|
@ -455,7 +455,7 @@
|
|||
if(file_exists($thumbnail_file)) {
|
||||
$file_created_time = date("YmdHis",filemtime($thumbnail_file));
|
||||
$modified_time = $this->get('last_update');
|
||||
if($modified_time > $file_created_time) @unlink($thumbnail_file);
|
||||
if($modified_time > $file_created_time) FileHandler::removeFile($thumbnail_file);
|
||||
}
|
||||
|
||||
if(file_exists($thumbnail_file)&&filesize($thumbnail_file)<1) return;
|
||||
|
|
@ -500,7 +500,7 @@
|
|||
$tmp_file = sprintf('%sthumbnail_%d.tmp.jpg', $document_path, $width);
|
||||
FileHandler::getRemoteFile($target_src, $tmp_file);
|
||||
FileHandler::createImageFile($tmp_file, $thumbnail_file, $width, $height, 'jpg', $config->thumbnail_type);
|
||||
@unlink($tmp_file);
|
||||
FileHandler::removeFile($tmp_file);
|
||||
return Context::getRequestUri().$thumbnail_file;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@
|
|||
if(!$trigger_output->toBool()) return $trigger_output;
|
||||
|
||||
// 삭제 성공하면 파일 삭제
|
||||
@unlink($uploaded_filename);
|
||||
FileHandler::removeFile($uploaded_filename);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -415,7 +415,7 @@
|
|||
FileHandler::makeDir($path);
|
||||
|
||||
// 파일 이동
|
||||
@rename($old_file, $new_file);
|
||||
FileHandler::rename($old_file, $new_file);
|
||||
|
||||
// DB 정보도 수정
|
||||
unset($args);
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
* @brief 지정된 파일의 지시자를 염
|
||||
**/
|
||||
function openFile() {
|
||||
@unlink($this->cache_index_file);
|
||||
FileHandler::removeFile($this->cache_index_file);
|
||||
$this->index_fd = fopen($this->cache_index_file,"a");
|
||||
|
||||
// local 파일일 경우
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
$buff = FileHandler::readFile($target_file);
|
||||
fwrite($fd, FileHandler::readFile($target_file));
|
||||
|
||||
@unlink($target_file);
|
||||
FileHandler::removeFile($target_file);
|
||||
}
|
||||
fwrite($fd, '</items>');
|
||||
fclose($fd);
|
||||
|
|
|
|||
|
|
@ -190,7 +190,7 @@
|
|||
|
||||
// 대상 파일을 읽여서 파싱후 입력
|
||||
$xmlObj = $oXmlParser->loadXmlFile($target_file);
|
||||
@unlink($target_file);
|
||||
FileHandler::removeFile($target_file);
|
||||
if(!$xmlObj) continue;
|
||||
|
||||
// 객체 정리
|
||||
|
|
@ -326,7 +326,7 @@
|
|||
|
||||
// 대상 파일을 읽여서 파싱후 입력
|
||||
$xmlObj = $oXmlParser->loadXmlFile($target_file);
|
||||
@unlink($target_file);
|
||||
FileHandler::removeFile($target_file);
|
||||
if(!$xmlObj) continue;
|
||||
|
||||
// 객체 정리
|
||||
|
|
@ -433,7 +433,7 @@
|
|||
$oDocumentController = &getController('document');
|
||||
$oDocumentController->makeCategoryFile($module_srl);
|
||||
}
|
||||
@unlink($category_file);
|
||||
FileHandler::removeFile($category_file);
|
||||
}
|
||||
|
||||
$category_list = $category_titles = array();
|
||||
|
|
@ -558,7 +558,7 @@
|
|||
}
|
||||
|
||||
fclose($fp);
|
||||
@unlink($target_file);
|
||||
FileHandler::removeFile($target_file);
|
||||
}
|
||||
|
||||
fclose($f);
|
||||
|
|
@ -793,7 +793,7 @@
|
|||
// 디렉토리 생성
|
||||
if(!FileHandler::makeDir($path)) continue;
|
||||
|
||||
if(preg_match('/^\.\/files\/cache\/tmp/i',$file_obj->file)) @rename($file_obj->file, $filename);
|
||||
if(preg_match('/^\.\/files\/cache\/tmp/i',$file_obj->file)) FileHandler::rename($file_obj->file, $filename);
|
||||
else @copy($file_obj->file, $filename);
|
||||
|
||||
// DB입력
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
}
|
||||
$oDocumentController->makeCategoryFile($module_srl);
|
||||
}
|
||||
@unlink($category_file);
|
||||
FileHandler::removeFile($category_file);
|
||||
}
|
||||
$category_list = $category_titles = array();
|
||||
$category_list = $oDocumentModel->getCategoryList($module_srl);
|
||||
|
|
@ -239,7 +239,7 @@
|
|||
}
|
||||
|
||||
fclose($fp);
|
||||
@unlink($target_file);
|
||||
FileHandler::removeFile($target_file);
|
||||
}
|
||||
|
||||
fclose($f);
|
||||
|
|
@ -298,7 +298,7 @@
|
|||
// 디렉토리 생성
|
||||
if(!FileHandler::makeDir($path)) continue;
|
||||
|
||||
@rename($file_obj->file, $filename);
|
||||
FileHandler::rename($file_obj->file, $filename);
|
||||
|
||||
// DB입력
|
||||
unset($file_obj->file);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y') {
|
||||
@unlink($module_info->{$vars->name});
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
unset($extra_vars->{"del_".$name});
|
||||
if($del_var == 'Y') {
|
||||
$extra_vars->{$name} = '';
|
||||
@unlink($extra_vars->{$name});
|
||||
FileHandler::removeFile($extra_vars->{$name});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -140,7 +140,7 @@
|
|||
$output = executeQuery('layout.updateLayout', $args);
|
||||
if($output->toBool()) {
|
||||
$cache_file = sprintf('./files/cache/layout/%s.%s.cache.php', $args->layout_srl, Context::getLangType());
|
||||
@unlink($cache_file);
|
||||
FileHandler::removeFile($cache_file);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
@ -157,12 +157,12 @@
|
|||
if(count($cache_list)) {
|
||||
foreach($cache_list as $cache_file) {
|
||||
$pos = strpos($cache_file, $layout_srl.'_');
|
||||
if($pos>0) unlink($cache_file);
|
||||
if($pos>0)FileHandler::removeFile($cache_file);
|
||||
}
|
||||
}
|
||||
|
||||
$layout_file = sprintf('./files/cache/layout/%d.html', $layout_srl);
|
||||
if(file_exists($layout_file)) @unlink($layout_file);
|
||||
if(file_exists($layout_file)) FileHandler::removeFile($layout_file);
|
||||
|
||||
// 레이아웃 삭제
|
||||
$args->layout_srl = $layout_srl;
|
||||
|
|
@ -200,7 +200,7 @@
|
|||
if(!$layout_srl) return new Object(-1, 'msg_invalid_request');
|
||||
|
||||
$layout_file = sprintf('./files/cache/layout/%d.html', $layout_srl);
|
||||
@unlink($layout_file);
|
||||
FileHandler::removeFile($layout_file);
|
||||
|
||||
$this->setMessage('success_reset');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@
|
|||
Context::set('layout_tpl', $layout_tpl);
|
||||
|
||||
// 임시 파일 삭제
|
||||
@unlink($edited_layout_file);
|
||||
FileHandler::removeFile($edited_layout_file);
|
||||
|
||||
$this->setTemplateFile('layout_preview');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
$directory = dir($path);
|
||||
while($entry = $directory->read()) {
|
||||
if ($entry == "." || $entry == ".." || preg_match('/\.html$/i',$entry) ) continue;
|
||||
@unlink($path."/".$entry);
|
||||
FileHandler::removeFile($path."/".$entry);
|
||||
}
|
||||
$directory->close();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@
|
|||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y') {
|
||||
@unlink($module_info->{$vars->name});
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@
|
|||
if($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl) {
|
||||
$oMemberModel = &getModel('member');
|
||||
$profile_image = $oMemberModel->getProfileImage($member_srl);
|
||||
@unlink($profile_image->file);
|
||||
FileHandler::removeFile($profile_image->file);
|
||||
}
|
||||
return new Object(0,'success');
|
||||
}
|
||||
|
|
@ -640,7 +640,7 @@
|
|||
if($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl) {
|
||||
$oMemberModel = &getModel('member');
|
||||
$image_name = $oMemberModel->getImageName($member_srl);
|
||||
@unlink($image_name->file);
|
||||
FileHandler::removeFile($image_name->file);
|
||||
}
|
||||
return new Object(0,'success');
|
||||
}
|
||||
|
|
@ -705,7 +705,7 @@
|
|||
if($logged_info->is_admin == 'Y' || $logged_info->member_srl == $member_srl) {
|
||||
$oMemberModel = &getModel('member');
|
||||
$image_mark = $oMemberModel->getImageMark($member_srl);
|
||||
@unlink($image_mark->file);
|
||||
FileHandler::removeFile($image_mark->file);
|
||||
}
|
||||
return new Object(0,'success');
|
||||
}
|
||||
|
|
@ -830,7 +830,7 @@
|
|||
$path = sprintf('files/member_extra_info/signature/%s/', getNumberingPath($member_srl));
|
||||
$filename = sprintf('%s%d.signature.php', $path, $member_srl);
|
||||
|
||||
if(!$check_signature) return @unlink($filename);
|
||||
if(!$check_signature) return FileHandler::removeFile($filename);
|
||||
|
||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit();?>%s', $signature);
|
||||
FileHandler::makeDir($path);
|
||||
|
|
@ -842,7 +842,7 @@
|
|||
**/
|
||||
function delSignature($member_srl) {
|
||||
$filename = sprintf('files/member_extra_info/signature/%s%d.gif', getNumberingPath($member_srl), $member_srl);
|
||||
@unlink($filename);
|
||||
FileHandler::removeFile($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -443,7 +443,7 @@ class HTTPRetriever {
|
|||
|
||||
if (time()-filemtime($filename)>$this->caching) {
|
||||
$this->progress(HRP_DEBUG,"Page in cache is expired");
|
||||
@unlink($filename);
|
||||
FileHandler::removeFile($filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -341,7 +341,7 @@ function curl_setopt($ch,$option,$value) {
|
|||
}
|
||||
fclose($fp);
|
||||
// if a temporary file was previously created, unlink it
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"])) unlink($settings["upload-file"]["value"]);
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"]))FileHandler::removeFile($settings["upload-file"]["value"]);
|
||||
|
||||
// set the new upload-file filename
|
||||
$settings["upload-file"]["value"] = $tmpfilename;
|
||||
|
|
@ -581,7 +581,7 @@ function curl_close($ch) {
|
|||
$settings = &$opt["settings"];
|
||||
// if the user used CURLOPT_INFILE to specify a file to upload, remove the
|
||||
// temporary file created for the CURL binary
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"])) unlink($settings["upload-file"]["value"]);
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"]))FileHandler::removeFile($settings["upload-file"]["value"]);
|
||||
}
|
||||
|
||||
unset($GLOBALS["_CURLEXT_OPT"][$ch]);
|
||||
|
|
@ -634,4 +634,4 @@ function curl_version() {
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ function curl_close($ch) {
|
|||
$settings = &$opt["settings"];
|
||||
// if the user used CURLOPT_INFILE to specify a file to upload, remove the
|
||||
// temporary file created for the CURL binary
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"])) unlink($settings["upload-file"]["value"]);
|
||||
if ($settings["upload-file"]["value"] && file_exists($settings["upload-file"]["value"]))FileHandler::removeFile($settings["upload-file"]["value"]);
|
||||
}
|
||||
|
||||
unset($GLOBALS["_CURLNAT_OPT"][$ch]);
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@
|
|||
if(count($cache_list)) {
|
||||
foreach($cache_list as $cache_file) {
|
||||
$pos = strpos($cache_file, $menu_srl.'_');
|
||||
if($pos>0) unlink($cache_file);
|
||||
if($pos>0)FileHandler::removeFile($cache_file);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -196,9 +196,9 @@
|
|||
$xml_file = $this->makeXmlFile($args->menu_srl);
|
||||
|
||||
// 이미지 버튼 모두 삭제
|
||||
if($item_info->normal_btn) @unlink($item_info->normal_btn);
|
||||
if($item_info->hover_btn) @unlink($item_info->hover_btn);
|
||||
if($item_info->active_btn) @unlink($item_info->active_btn);
|
||||
if($item_info->normal_btn) FileHandler::removeFile($item_info->normal_btn);
|
||||
if($item_info->hover_btn) FileHandler::removeFile($item_info->hover_btn);
|
||||
if($item_info->active_btn) FileHandler::removeFile($item_info->active_btn);
|
||||
|
||||
$this->add('xml_file', $xml_file);
|
||||
$this->add('menu_title', $menu_title);
|
||||
|
|
@ -305,7 +305,7 @@
|
|||
$menu_item_srl = Context::get('menu_item_srl');
|
||||
$target = Context::get('target');
|
||||
$filename = Context::get('filename');
|
||||
@unlink($filename);
|
||||
FileHandler::removeFile($filename);
|
||||
|
||||
$this->add('target', $target);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
$output = executeQuery('module.deleteModuleConfig', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
@unlink( sprintf('./files/cache/module_info/%s.config.php',$module) );
|
||||
FileHandler::removeFile( sprintf('./files/cache/module_info/%s.config.php',$module) );
|
||||
|
||||
// 변수 정리후 query 실행
|
||||
$output = executeQuery('module.insertModuleConfig', $args);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@
|
|||
|
||||
// 캐시 파일 삭제
|
||||
$cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl);
|
||||
if(file_exists($cache_file)) @unlink($cache_file);
|
||||
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
|
||||
|
||||
// 등록 성공후 return될 메세지 정리
|
||||
$this->add("module_srl", $module_args->module_srl);
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@
|
|||
|
||||
// 캐시 검사
|
||||
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);
|
||||
if(file_exists($cache_file)) FileHandler::removeFile($cache_file);
|
||||
|
||||
// 일단 대상 파일을 읽어서 내용을 구함
|
||||
ob_start();
|
||||
|
|
|
|||
|
|
@ -286,10 +286,11 @@
|
|||
}
|
||||
|
||||
if(feof($f)) {
|
||||
@unlink('./files/cache/pointRecal.txt');
|
||||
FileHandler::removeFile('./files/cache/pointRecal.txt');
|
||||
$idx = $total;
|
||||
|
||||
@rename('./files/member_extra_info/point','./files/member_extra_info/point.old');
|
||||
FileHandler::rename('./files/member_extra_info/point','./files/member_extra_info/point.old');
|
||||
|
||||
FileHandler::removeDir('./files/member_extra_info/point.old');
|
||||
}
|
||||
fclose($f);
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@
|
|||
$del_var = $obj->{"del_".$vars->name};
|
||||
unset($obj->{"del_".$vars->name});
|
||||
if($del_var == 'Y') {
|
||||
@unlink($module_info->{$vars->name});
|
||||
FileHandler::removeFile($module_info->{$vars->name});
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
|
||||
if( file_exists($this->cachedir.$this->cachefile) )
|
||||
{
|
||||
unlink($this->cachedir.$this->cachefile);
|
||||
FileHandler::removeFile($this->cachedir.$this->cachefile);
|
||||
}
|
||||
|
||||
$oModel = &getModel('tccommentnotify');
|
||||
|
|
@ -101,7 +101,7 @@
|
|||
$this->sendCommentNotify($data->comment_srl);
|
||||
}
|
||||
}
|
||||
unlink($lockFilePath);
|
||||
FileHandler::removeFile($lockFilePath);
|
||||
}
|
||||
|
||||
function deleteFromQueue($comment_srl)
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
if($vars->widget_sequence) {
|
||||
$cache_path = './files/cache/widget_cache/';
|
||||
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
|
||||
@unlink($cache_file);
|
||||
FileHandler::removeFile($cache_file);
|
||||
}
|
||||
|
||||
if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
|
||||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
$cache_path = './files/cache/widget_cache/';
|
||||
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
|
||||
@unlink($cache_file);
|
||||
FileHandler::removeFile($cache_file);
|
||||
|
||||
// 코드 출력
|
||||
$this->add('widget_code', $widget_code);
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
if($vars->widget_sequence) {
|
||||
$cache_path = './files/cache/widget_cache/';
|
||||
$cache_file = sprintf('%s%d.%s.cache', $cache_path, $vars->widget_sequence, Context::getLangType());
|
||||
@unlink($cache_file);
|
||||
FileHandler::removeFile($cache_file);
|
||||
}
|
||||
|
||||
if($vars->widget_cache>0) $vars->widget_sequence = getNextSequence();
|
||||
|
|
|
|||
32
tools/cache_cleaner/form.html
Normal file
32
tools/cache_cleaner/form.html
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="Generator" content="XE" />
|
||||
<title>XE Cache Cleaner</title>
|
||||
<link rel="stylesheet" href="./style.css" type="text/css" charset="UTF-8" media="all" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>XE Cache Cleaner</h1>
|
||||
<hr />
|
||||
|
||||
<!--@if($msg)-->
|
||||
<blockquote>{$msg}</blockquote>
|
||||
<!--@end-->
|
||||
|
||||
<form action="./index.php" method="post">
|
||||
<code>
|
||||
<label for="db_id">{$lang->db_userid}</label>
|
||||
<input type="text" id="db_id" name="id" />
|
||||
</code>
|
||||
<code>
|
||||
<label for="db_pw">{$lang->db_password}</label>
|
||||
<input type="password" id="db_pw" name="pw" />
|
||||
</code>
|
||||
|
||||
<input type="submit" value="{$lang->cmd_reset}" class="submit"/>
|
||||
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
58
tools/cache_cleaner/index.php
Normal file
58
tools/cache_cleaner/index.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
/**
|
||||
* @file tools/clear_cache.php
|
||||
* @author zero <zero@zeroboard.com>
|
||||
* @brief XE 캐시파일 및 불필요한 파일 정리
|
||||
**/
|
||||
|
||||
/**
|
||||
* @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언
|
||||
**/
|
||||
define('__ZBXE__', true);
|
||||
|
||||
/**
|
||||
* @brief 필요한 설정 파일들을 include
|
||||
**/
|
||||
require_once('../../config/config.inc.php');
|
||||
|
||||
// id/ password 구함
|
||||
$id = $_POST['id'];
|
||||
$pw = $_POST['pw'];
|
||||
|
||||
// 저장되어 있는 비밀번호와 비교
|
||||
$oContext = &Context::getInstance();
|
||||
$oContext->init();
|
||||
$db_info = $oContext->getDBInfo();
|
||||
|
||||
// install 모듈의 언어파일을 로드
|
||||
Context::loadLang(_XE_PATH_.'modules/install/lang');
|
||||
|
||||
// 설치가 되어 있지 않을 경우
|
||||
if(!Context::isInstalled()) {
|
||||
|
||||
$msg = Context::getLang('msg_db_not_setted');
|
||||
|
||||
// 인증 정보가 없을 경우
|
||||
} elseif(!isset($id) || !isset($pw)) {
|
||||
|
||||
|
||||
// 입력된 정보와 저장된 정보 비교
|
||||
} else if($id !== $db_info->db_userid || $pw !== $db_info->db_password) {
|
||||
|
||||
if($id !== $db_info->db_userid) $msg = sprintf($lang->filter->equalto, Context::getLang('user_id'));
|
||||
else $msg = sprintf($lang->filter->equalto, Context::getLang('password'));
|
||||
|
||||
// 캐시 파일 제거
|
||||
} else if($id === $db_info->db_userid && $pw === $db_info->db_password) {
|
||||
|
||||
$oAdminController = &getAdminController('admin');
|
||||
$oAdminController->procAdminRecompileCacheFile();
|
||||
$msg = Context::getLang('success_reset');
|
||||
|
||||
}
|
||||
|
||||
Context::set('msg', $msg);
|
||||
|
||||
$oTemplate = &TemplateHandler::getInstance();
|
||||
print $oTemplate->compile('./tools/cache_cleaner/','form');
|
||||
?>
|
||||
10
tools/cache_cleaner/style.css
Normal file
10
tools/cache_cleaner/style.css
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
h1 { font-size:1.5em; font-family:tahoma; margin:0; padding:0; }
|
||||
hr { border:none; border-top:1px solid #555555; border-bottom:1px solid #888888; margin:0; margin-bottom:10px; padding:0; }
|
||||
blockquote { border:1px solid red; color:red; width:280px; margin:0 0 10px 0; padding:10px;}
|
||||
|
||||
code { display:block; clear:both; margin-bottom:10px;}
|
||||
code label { float:left; display:block; width:150px; }
|
||||
code input { display:block; width:150px; border:1px solid #AAAAAA; }
|
||||
|
||||
input.submit { width:300px; border:1px solid #AAAAAA;}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue