mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 18:51:41 +09:00
#17217104 게시글 삭제시 댓글을 지우는 comment의 trigger에서 db에서만 댓글을 지우기에 file 모듈에서 댓글의 파일을 지우지 못하는 문제가 발생.
일괄 댓글 삭제시에 대상 댓글별 trigger를 호출하고 나서 일괄 삭제하도록 하여 문제 개선 git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6329 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
522a350d81
commit
e14f832aec
3 changed files with 27 additions and 1 deletions
|
|
@ -398,11 +398,27 @@
|
|||
function deleteComments($document_srl) {
|
||||
// document model객체 생성
|
||||
$oDocumentModel = &getModel('document');
|
||||
$oCommentModel = &getModel('comment');
|
||||
|
||||
// 권한이 있는지 확인
|
||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
|
||||
|
||||
// 댓글 목록을 가져와서 일단 trigger만 실행 (일괄 삭제를 해야 하기에 최대한 처리 비용을 줄이기 위한 방법)
|
||||
$args->document_srl = $document_srl;
|
||||
$comments = executeQueryArray('comment.getAllComments',$args);
|
||||
if($comments->data) {
|
||||
foreach($comments->data as $key => $comment) {
|
||||
// trigger 호출 (before)
|
||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
||||
if(!$output->toBool()) continue;
|
||||
|
||||
// trigger 호출 (after)
|
||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
||||
if(!$output->toBool()) continue;
|
||||
}
|
||||
}
|
||||
|
||||
// 댓글 본문 삭제
|
||||
$args->document_srl = $document_srl;
|
||||
$output = executeQuery('comment.deleteComments', $args);
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@
|
|||
function getCommentAllCount($module_srl) {
|
||||
$args->module_srl = $module_srl;
|
||||
$output = executeQuery('comment.getCommentCount', $args);
|
||||
debugPrint($output);
|
||||
$total_count = $output->data->count;
|
||||
|
||||
return (int)$total_count;
|
||||
|
|
|
|||
11
modules/comment/queries/getAllComments.xml
Normal file
11
modules/comment/queries/getAllComments.xml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
<query id="getAllComments" action="select">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="comment_srl" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="document_srl" var="document_srl" notnull="notnull" />
|
||||
</conditions>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue