mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-21 11:22:34 +09:00
게시글/모듈 삭제시 첨부파일을 정확히 추적하여 삭제하도록 코드 수정
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4377 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
d98583921d
commit
b206a07524
4 changed files with 60 additions and 10 deletions
|
|
@ -17,15 +17,34 @@
|
|||
* @brief 특정 모두의 첨부파일 모두 삭제
|
||||
**/
|
||||
function deleteModuleFiles($module_srl) {
|
||||
// 전체 첨부파일 목록을 구함
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('file.getModuleFiles',$args);
|
||||
if(!$output) return $output;
|
||||
$files = $output->data;
|
||||
|
||||
// DB에서 삭제
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('file.deleteModuleFiles', $args);
|
||||
if(!$output->toBool()) return $output;
|
||||
|
||||
// 실제 파일 삭제
|
||||
$path[0] = sprintf("./files/attach/images/%s/", $module_srl);
|
||||
$path[1] = sprintf("./files/attach/binaries/%s/", $module_srl);
|
||||
FileHandler::removeDir($path[0]);
|
||||
FileHandler::removeDir($path[1]);
|
||||
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
|
||||
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
||||
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
||||
|
||||
// DB에서 구한 파일 목록을 삭제
|
||||
$path = array();
|
||||
$cnt = count($files);
|
||||
for($i=0;$i<$cnt;$i++) {
|
||||
$uploaded_filename = $files[$i]->uploaded_filename;
|
||||
FileHandler::removeFile($uploaded_filename);
|
||||
|
||||
$path_info = pathinfo($uploaded_filename);
|
||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
||||
}
|
||||
|
||||
// 해당 글의 첨부파일 디렉토리 삭제
|
||||
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue