Skip to content

Commit

Permalink
#2253 #2256 문서 이동 시 기존 article ID 삭제
Browse files Browse the repository at this point in the history
  • Loading branch information
bnu committed Apr 13, 2018
1 parent 15be02c commit 1296a12
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
6 changes: 5 additions & 1 deletion modules/document/document.admin.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
$triggerObj = new stdClass();
$triggerObj->document_srls = implode(',',$document_srl_list);
$triggerObj->module_srl = $module_srl;
$triggerObj->source_module_srl = array();
$triggerObj->category_srl = $category_srl;

// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
if(!$output->toBool())
Expand All @@ -79,14 +81,16 @@ function moveDocumentModule($document_srl_list, $module_srl, $category_srl)
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists()) continue;

$triggerObj->source_module_srl[$document_srl] = $oDocument->get('module_srl');

$source_category_srl = $oDocument->get('category_srl');

unset($obj);
$obj = $oDocument->getObjectVars();

// ISSUE https://github.com/xpressengine/xe-core/issues/32
$args_doc_origin->document_srl = $document_srl;
$output_ori = executeQuery('document.getDocument', $args_doc_origin, array('content'));
$output_ori = executeQuery('document.getDocument', $args_doc_origin, array('content'));
$obj->content = $output_ori->data->content;

// Move the attached file if the target module is different
Expand Down
21 changes: 14 additions & 7 deletions modules/syndication/syndication.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function triggerUpdateDocument(&$obj) {
// PUBLIC 외 삭제
if($obj->status === 'PUBLIC')
{
$this->ping($id, 'article');
$this->ping($id, 'article');
}
else
{
Expand All @@ -62,14 +62,12 @@ function triggerUpdateDocument(&$obj) {
function triggerDeleteDocument(&$obj) {
if($obj->module_srl < 1) return $this->makeObject();

$oSyndicationModel = getModel('syndication');
$oModuleModel = getModel('module');

if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();
$oSyndicationModel = getModel('syndication');

$config = $oModuleModel->getModuleConfig('syndication');

if($config->syndication_use!='Y') return $this->makeObject();
if($config->syndication_use != 'Y') return $this->makeObject();
if($oSyndicationModel->isExceptedModules($obj->module_srl)) return $this->makeObject();

$this->insertLog($obj->module_srl, $obj->document_srl, $obj->title, $obj->content);

Expand Down Expand Up @@ -119,6 +117,16 @@ function triggerMoveDocumentModule(&$obj)

foreach($arr_document_srl as $document_srl)
{
// 기존 문서 삭제
$source_module_srl = $obj->source_module_srl[$document_srl];
if(!!$source_module_srl)
{
$target_id = sprintf('%s-%s', $source_module_srl, $document_srl);
$id = $oSyndicationModel->getID('article', $target_id);
$this->ping($id, 'deleted');
}

// 옮겨진 문서 추가
$target_id = sprintf('%s-%s', $obj->module_srl, $document_srl);
$id = $oSyndicationModel->getID('article', $target_id);
$this->ping($id, 'article');
Expand Down Expand Up @@ -186,7 +194,6 @@ function deleteLog($module_srl, $document_srl)

function ping($id, $type, $page=1) {
$this->ping_message = '';
debugPrint($id);
$oSyndicationModel = getModel('syndication');

$oModuleModel = getModel('module');
Expand Down

0 comments on commit 1296a12

Please sign in to comment.