fix #571 document.updateReadedCount 트리거가 잘못 설정된 문제 수정

- after 트리거의 위치 조정 및 before 추가
- 트랜잭션 처리 추가
This commit is contained in:
bnu 2014-03-13 13:02:51 +09:00
parent 65ff909dd9
commit 30a216a044

View file

@ -818,9 +818,10 @@ class documentController extends document
$document_srl = $oDocument->document_srl;
$member_srl = $oDocument->get('member_srl');
$logged_info = Context::get('logged_info');
// Call a trigger when the read count is updated (after)
$output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
if(!$output->toBool()) return $output;
// Call a trigger when the read count is updated (before)
$trigger_output = ModuleHandler::triggerCall('document.updateReadedCount', 'before', $oDocument);
if(!$trigger_output->toBool()) return $trigger_output;
// Pass if read count is increaded on the session information
if($_SESSION['readed_document'][$document_srl]) return false;
@ -837,11 +838,25 @@ class documentController extends document
$_SESSION['readed_document'][$document_srl] = true;
return false;
}
$oDB = DB::getInstance();
$oDB->begin();
// Update read counts
$args = new stdClass;
$args->document_srl = $document_srl;
$output = executeQuery('document.updateReadedCount', $args);
// Call a trigger when the read count is updated (after)
$outptrigger_outputut = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument);
if(!$trigger_output->toBool())
{
$oDB->rollback();
return $trigger_output;
}
$oDB->commit();
$oCacheHandler = CacheHandler::getInstance('object');
if($oCacheHandler->isSupport())
{