From 30a216a044c35744b2c4400d946a41f5f4c89ec8 Mon Sep 17 00:00:00 2001 From: bnu Date: Thu, 13 Mar 2014 13:02:51 +0900 Subject: [PATCH] =?UTF-8?q?fix=20#571=20`document.updateReadedCount`=20?= =?UTF-8?q?=ED=8A=B8=EB=A6=AC=EA=B1=B0=EA=B0=80=20=EC=9E=98=EB=AA=BB=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95=EB=90=9C=20=EB=AC=B8=EC=A0=9C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95=20-=20after=20=ED=8A=B8=EB=A6=AC=EA=B1=B0=EC=9D=98=20?= =?UTF-8?q?=EC=9C=84=EC=B9=98=20=EC=A1=B0=EC=A0=95=20=EB=B0=8F=20before=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20-=20=ED=8A=B8=EB=9E=9C=EC=9E=AD=EC=85=98?= =?UTF-8?q?=20=EC=B2=98=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/document/document.controller.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 3c8f0e9dd..6029c7fcf 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -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()) {