mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
copyDocumentModule(), deleteModuleDocument() 정리, 성능 개선
This commit is contained in:
parent
3d2ade4aa1
commit
54401ea28f
10 changed files with 366 additions and 417 deletions
|
|
@ -114,7 +114,11 @@ class comment extends ModuleObject
|
|||
return true;
|
||||
}
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggeMoveDocumentModule', 'after'))
|
||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add'))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
|
@ -210,9 +214,13 @@ class comment extends ModuleObject
|
|||
$oDB->addIndex('comments', 'idx_nick_name', array('nick_name'));
|
||||
}
|
||||
|
||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggeMoveDocumentModule', 'after'))
|
||||
if(!$oModuleModel->getTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after'))
|
||||
{
|
||||
$oModuleController->insertTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggeMoveDocumentModule', 'after');
|
||||
$oModuleController->insertTrigger('document.moveDocumentModule', 'comment', 'controller', 'triggerMoveDocument', 'after');
|
||||
}
|
||||
if(!$oModuleModel->getTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add'))
|
||||
{
|
||||
$oModuleController->insertTrigger('document.copyDocumentModule', 'comment', 'controller', 'triggerAddCopyDocument', 'add');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1727,12 +1727,44 @@ class commentController extends comment
|
|||
$this->add('comment_list', $commentList);
|
||||
}
|
||||
|
||||
function triggeMoveDocumentModule($obj)
|
||||
function triggerMoveDocument($obj)
|
||||
{
|
||||
executeQuery('comment.updateCommentModule', $obj);
|
||||
executeQuery('comment.updateCommentListModule', $obj);
|
||||
}
|
||||
|
||||
function triggerAddCopyDocument(&$obj)
|
||||
{
|
||||
$args = new stdClass;
|
||||
$args->document_srls = $obj->source->document_srl;
|
||||
$comment_list = executeQueryArray('comment.getCommentsByDocumentSrls', $args)->data;
|
||||
|
||||
$copied_comments = array();
|
||||
foreach($comment_list as $comment)
|
||||
{
|
||||
$copy = clone $comment;
|
||||
$copy->comment_srl = getNextSequence();
|
||||
$copy->module_srl = $obj->copied->module_srl;
|
||||
$copy->document_srl = $obj->copied->document_srl;
|
||||
$copy->parent_srl = $comment->parent_srl ? $copied_comments[$comment->parent_srl] : 0;
|
||||
|
||||
// call a trigger (add)
|
||||
$args = new stdClass;
|
||||
$args->source = $comment;
|
||||
$args->copied = $copy;
|
||||
ModuleHandler::triggerCall('comment.copyCommentByDocument', 'add', $args);
|
||||
|
||||
// insert a copied comment
|
||||
$this->insertComment($copy, true);
|
||||
|
||||
$copied_comments[$comment->comment_srl] = $copy->comment_srl;
|
||||
}
|
||||
|
||||
// update
|
||||
$obj->copied->last_updater = $copy->nick_name;
|
||||
$obj->copied->comment_count = count($copied_comments);
|
||||
}
|
||||
|
||||
function triggerCopyModule(&$obj)
|
||||
{
|
||||
$oModuleModel = getModel('module');
|
||||
|
|
|
|||
14
modules/comment/queries/getCommentsByDocumentSrls.xml
Normal file
14
modules/comment/queries/getCommentsByDocumentSrls.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<query id="getCommentsByDocumentSrls" action="select">
|
||||
<tables>
|
||||
<table name="comments" />
|
||||
</tables>
|
||||
<columns>
|
||||
<column name="*" />
|
||||
</columns>
|
||||
<conditions>
|
||||
<condition operation="in" column="document_srl" var="document_srls" filter="number" notnull="notnull" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="comment_srl" order="asc" />
|
||||
</navigation>
|
||||
</query>
|
||||
Loading…
Add table
Add a link
Reference in a new issue