r7434 fix

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7438 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2010-05-11 10:20:27 +00:00
parent 96c71e8c9e
commit fe09e55c51
12 changed files with 187 additions and 44 deletions

View file

@ -409,6 +409,7 @@
* @brief 문서 삭제
**/
function deleteDocument($document_srl, $is_admin = false) {
// trigger 호출 (before)
$trigger_obj->document_srl = $document_srl;
$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj);
@ -465,6 +466,7 @@
// commit
$oDB->commit();
return $output;
}
@ -472,6 +474,7 @@
* @brief 문서를 휴지통으로 옮김
**/
function moveDocumentToTrash($obj) {
// 주어진 trash_srl이 없으면 trash_srl 등록
if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence();
else $trash_args->trash_srl = $obj->trash_srl;
@ -565,7 +568,13 @@
// 조회수 업데이트
$args->document_srl = $document_srl;
$output = executeQuery('document.updateReadedCount', $args);
$output = executeQuery('document.updateReadedCount', $args, false);
$CacheHandler = &CacheHandler::getInstance();
if($CacheHandler->isSupport()){
$readed_count = $oDocument->get('readed_count')+1;
$oDocument->add('readed_count', $readed_count);
$CacheHandler->put('readed_count:'.$document_srl, $readed_count);
}
// 세션 등록
$_SESSION['readed_document'][$document_srl] = true;

View file

@ -56,6 +56,12 @@
$this->add('title', $GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl]->get('title'));
$this->add('content', $GLOBALS['XE_DOCUMENT_LIST'][$this->document_srl]->get('content'));
}
$CacheHandler = &CacheHandler::getInstance();
if($CacheHandler->isSupport()){
$readed_count = $CacheHandler->get('readed_count:'.$document_srl);
if($readed_count) $this->add('readed_count', $readed_count);
}
}
function isExists() {

View file

@ -95,11 +95,12 @@
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true) {
if(!$document_srl) return new documentItem();
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl])) {
$oDocument = new documentItem($document_srl, true);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
if($load_extra_vars) $this->setToAllDocumentExtraVars();
}
if(!isset($GLOBALS['XE_DOCUMENT_LIST'][$document_srl])) {
$oDocument = new documentItem($document_srl, true);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
if($load_extra_vars) $this->setToAllDocumentExtraVars();
}
if($is_admin) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->setGrant();
return $GLOBALS['XE_DOCUMENT_LIST'][$document_srl];
@ -160,6 +161,21 @@
if(!in_array($obj->sort_index, array('list_order','regdate','last_update','update_order','readed_count','voted_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) $obj->sort_index = 'list_order';
if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
$CacheHandler = &CacheHandler::getInstance();
$cache_support = $CacheHandler->isSupport();
if($cache_support){
$obj->e = $except_notice;
$obj->l = $load_extra_vars;
$oDB = &DB::getInstance();
$mtime = $oDB->_getTableMtime(array('documents'));
$cache_key = 'documentlist'.serialize($obj);
$buff = $CacheHandler->get($cache_key, $mtime);
if($buff){
return $buff;
}
}
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
if($obj->mid) {
$oModuleModel = &getModel('module');
@ -404,6 +420,9 @@
}
}
if($cache_support && $cache_key){
$CacheHandler->put($cache_key, $output);
}
return $output;
}