git-svn-id: http://xe-core.googlecode.com/svn/trunk@979 201d5d3c-b55e-5fd7-737f-ddc643e51545

This commit is contained in:
zero 2007-04-05 06:05:05 +00:00
parent 2a9f617e1b
commit 959560097b
6 changed files with 128 additions and 19 deletions

View file

@ -87,7 +87,7 @@
* @brief 롤백
**/
function rollback() {
if(!$this->is_connected || $this->transaction_started) return;
if(!$this->is_connected || !$this->transaction_started) return;
$this->_query("ROLLBACK;");
$this->transaction_started = false;
}
@ -96,7 +96,7 @@
* @brief 커밋
**/
function commit() {
if(!$this->is_connected || $this->transaction_started) return;
if(!$this->is_connected || !$this->transaction_started) return;
$this->_query("COMMIT;");
$this->transaction_started = false;
}

View file

@ -93,7 +93,7 @@
* @brief 롤백
**/
function rollback() {
if(!$this->is_connected || $this->transaction_started) return;
if(!$this->is_connected || !$this->transaction_started) return;
$this->handler->rollBack();
$this->transaction_started = false;
}
@ -102,7 +102,7 @@
* @brief 커밋
**/
function commit() {
if(!$this->is_connected || $this->transaction_started) return;
if(!$this->is_connected || !$this->transaction_started) return;
$this->handler->commit();
$this->transaction_started = false;
}

View file

@ -54,10 +54,10 @@
// 컨텐츠 출력
if(Context::getResponseMethod()!="XMLRPC") {
ini_set('zlib.output_compression_level',3);
ob_start('ob_gzhandler');
//ini_set('zlib.output_compression_level',3);
//ob_start('ob_gzhandler');
print trim($output);
ob_end_flush();
//ob_end_flush();
} else {
print trim($output);
}

View file

@ -49,6 +49,7 @@
* @brief 댓글 입력
**/
function insertComment($obj) {
// document_srl에 해당하는 글이 있는지 확인
$document_srl = $obj->document_srl;
if(!$document_srl) return new Object(-1,'msg_invalid_document');
@ -75,6 +76,10 @@
$obj->homepage = $logged_info->homepage;
}
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// file의 Model객체 생성
$oFileModel = &getModel('file');
@ -85,7 +90,10 @@
$output = executeQuery('comment.insertComment', $obj);
// 입력에 이상이 없으면 해당 글의 댓글 수를 올림
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// comment model객체 생성
$oCommentModel = &getModel('comment');
@ -102,6 +110,9 @@
// 댓글의 권한을 부여
$this->addGrant($obj->comment_srl);
// commit
$oDB->commit();
$output->add('comment_srl', $obj->comment_srl);
return $output;
}
@ -148,8 +159,19 @@
// 첨부 파일의 갯수를 구함
$obj->uploaded_count = $oFileModel->getFilesCount($obj->document_srl);
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 업데이트
$output = executeQuery('comment.updateComment', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// commit
$oDB->commit();
$output->add('comment_srl', $obj->comment_srl);
return $output;
@ -174,10 +196,17 @@
// 권한이 있는지 확인
if(!$is_admin && !$comment->is_granted) return new Object(-1, 'msg_not_permitted');
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 삭제
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.deleteComment', $args);
if(!$output->toBool()) return new Object(-1, 'msg_error_occured');
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 첨부 파일 삭제
if($comment->uploaded_count) {
@ -193,6 +222,13 @@
// 해당글의 댓글 수를 업데이트
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// commit
$oDB->commit();
$output->add('document_srl', $document_srl);
return $output;

View file

@ -47,6 +47,11 @@
* @brief 문서 입력
**/
function insertDocument($obj) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 기본 변수들 정리
if($obj->is_secret!='Y') $obj->is_secret = 'N';
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
@ -97,7 +102,10 @@
// DB에 입력
$output = executeQuery('document.insertDocument', $obj);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($obj->category_srl) $this->updateCategoryCount($obj->category_srl);
@ -112,6 +120,9 @@
$oFileController->setFilesValid($obj->document_srl);
}
// commit
$oDB->commit();
// return
$this->addGrant($obj->document_srl);
$output->add('document_srl',$obj->document_srl);
@ -123,6 +134,11 @@
* @brief 문서 수정
**/
function updateDocument($source_obj, $obj) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 기본 변수들 정리
if($obj->is_secret!='Y') $obj->is_secret = 'N';
if($obj->allow_comment!='Y') $obj->allow_comment = 'N';
@ -186,7 +202,11 @@
// DB에 입력
$output = executeQuery('document.updateDocument', $obj);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 성공하였을 경우 category_srl이 있으면 카테고리 update
if($source_obj->category_srl!=$obj->category_srl) {
@ -204,6 +224,9 @@
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc();
// commit
$oDB->commit();
$output->add('document_srl',$obj->document_srl);
return $output;
}
@ -213,6 +236,10 @@
**/
function deleteDocument($document_srl, $is_admin = false) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// document의 model 객체 생성
$oDocumentModel = &getModel('document');
@ -226,7 +253,10 @@
// 글 삭제
$args->document_srl = $document_srl;
$output = executeQuery('document.deleteDocument', $args);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 댓글 삭제
$oCommentController = &getController('comment');
@ -249,6 +279,9 @@
// 카테고리가 있으면 카테고리 정보 변경
if($document->category_srl) $this->updateCategoryCount($document->category_srl);
// commit
$oDB->commit();
return $output;
}

View file

@ -87,6 +87,10 @@
* @brief 모듈 입력
**/
function insertModule($args) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// module model 객체 생성
$oModuleModel = &getModel('module');
@ -99,7 +103,13 @@
$args->module_srl = getNextSequence();
$args->skin_vars = serialize($skin_vars);
$output = executeQuery('module.insertModule', $args);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// commit
$oDB->commit();
$output->add('module_srl',$args->module_srl);
return $output;
@ -161,6 +171,11 @@
* 모듈 삭제시는 관련 정보들을 모두 삭제 시도한다.
**/
function deleteModule($module_srl) {
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
$args->module_srl = $module_srl;
// addon 삭제
@ -170,34 +185,59 @@
// document 삭제
$oDocumentController = &getController('document');
$output = $oDocumentController->deleteModuleDocument($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// category 삭제
$output = $oDocumentController->deleteModuleCategory($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// trackbacks 삭제
$oTrackbackController = &getController('trackback');
$output = $oTrackbackController->deleteModuleTrackbacks($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// comments 삭제
$oCommentController = &getController('comment');
$output = $oCommentController->deleteModuleComments($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// tags 삭제
$oTagController = &getController('tag');
$output = $oTagController->deleteModuleTags($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 첨부 파일 삭제
$oFileController = &getController('file');
$output = $oFileController->deleteModuleFiles($module_srl);
if(!$output->toBool()) return $output;
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// module 정보를 DB에서 삭제
$output = executeQuery('module.deleteModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// commit
$oDB->commit();
return $output;
}