From e14f832aecdff081b10a7e6919bd8f5dd6078a9a Mon Sep 17 00:00:00 2001 From: zero Date: Mon, 18 May 2009 10:06:29 +0000 Subject: [PATCH] =?UTF-8?q?#17217104=20=EA=B2=8C=EC=8B=9C=EA=B8=80=20?= =?UTF-8?q?=EC=82=AD=EC=A0=9C=EC=8B=9C=20=EB=8C=93=EA=B8=80=EC=9D=84=20?= =?UTF-8?q?=EC=A7=80=EC=9A=B0=EB=8A=94=20comment=EC=9D=98=20trigger?= =?UTF-8?q?=EC=97=90=EC=84=9C=20db=EC=97=90=EC=84=9C=EB=A7=8C=20=EB=8C=93?= =?UTF-8?q?=EA=B8=80=EC=9D=84=20=EC=A7=80=EC=9A=B0=EA=B8=B0=EC=97=90=20fil?= =?UTF-8?q?e=20=EB=AA=A8=EB=93=88=EC=97=90=EC=84=9C=20=EB=8C=93=EA=B8=80?= =?UTF-8?q?=EC=9D=98=20=ED=8C=8C=EC=9D=BC=EC=9D=84=20=EC=A7=80=EC=9A=B0?= =?UTF-8?q?=EC=A7=80=20=EB=AA=BB=ED=95=98=EB=8A=94=20=EB=AC=B8=EC=A0=9C?= =?UTF-8?q?=EA=B0=80=20=EB=B0=9C=EC=83=9D.=20=EC=9D=BC=EA=B4=84=20?= =?UTF-8?q?=EB=8C=93=EA=B8=80=20=EC=82=AD=EC=A0=9C=EC=8B=9C=EC=97=90=20?= =?UTF-8?q?=EB=8C=80=EC=83=81=20=EB=8C=93=EA=B8=80=EB=B3=84=20trigger?= =?UTF-8?q?=EB=A5=BC=20=ED=98=B8=EC=B6=9C=ED=95=98=EA=B3=A0=20=EB=82=98?= =?UTF-8?q?=EC=84=9C=20=EC=9D=BC=EA=B4=84=20=EC=82=AD=EC=A0=9C=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=ED=95=98=EC=97=AC=20=EB=AC=B8=EC=A0=9C=20?= =?UTF-8?q?=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6329 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/comment/comment.controller.php | 16 ++++++++++++++++ modules/comment/comment.model.php | 1 - modules/comment/queries/getAllComments.xml | 11 +++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 modules/comment/queries/getAllComments.xml diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 74fe643c5..279aa9b71 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -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); diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 66e47b6d4..e2d8ba3f2 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -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; diff --git a/modules/comment/queries/getAllComments.xml b/modules/comment/queries/getAllComments.xml new file mode 100644 index 000000000..14d0d1a35 --- /dev/null +++ b/modules/comment/queries/getAllComments.xml @@ -0,0 +1,11 @@ + + + + + + + + + + +