사이트 내 전체검색
그누보드
[튜닝] 코멘트 사용하지 않는 경우 속도 개선
로빈아빠
https://cmd.kr/gnu/95 URL이 복사되었습니다.

본문

코멘트 사용하지 않는경우 wr_is_comment = '0' 조건을 검색식에서 제외할수 있고 이경우
건수가 많은 게시물에서는 속도 개선효과가 있다.

1. g4_board 테이블에 bo_hide_comment  tinyint  필드 추가

2. 게시판설정 기능 추가
   /adm/board_form.php 에서
 <tr class='ht'>
    <td><input type=checkbox name=chk_hide_comment value=1></td>
    <td>코멘트 사용않함</td>
    <td><input type=checkbox name=bo_hide_comment value='1' <?=$board[bo_hide_comment]?'checked':'';?>><b>사용안함</b>
        &nbsp;<?=help("댓글를 사용하지 않으면 조건검색에서 comment여부를 검사하지 않으므로 속도가 빨라집니다.")?></td>
</tr>


3. board_form_update.php 에
if ($chk_use_secret) $s .= " , bo_use_secret = '$bo_use_secret' ";
if ($chk_use_dhtml_editor) $s .= " , bo_use_dhtml_editor = '$bo_use_dhtml_editor' ";
if ($chk_hide_comment) $s .= " , bo_hide_comment = '$bo_hide_comment' ";
if ($chk_use_upload_tool) $s .= " , bo_use_upload_tool = '$bo_use_upload_tool' ";

                bo_use_dhtml_editor = '$_POST[bo_use_dhtml_editor]',
                bo_hide_comment  = '$_POST[bo_hide_comment]',
                bo_use_upload_tool = '$_POST[bo_use_upload_tool]',
                bo_use_rss_view     = '$_POST[bo_use_rss_view]',
 추가
4. /bbs/list.php 에 추가
if ($sca || $stx)
{
    $sql = " select distinct wr_parent from $write_table where $sql_search $sql_order limit $from_record, $board[bo_page_rows] ";
}
else
{
 // 2009-11-01 김성대 코멘트 사용않함으로 하면 속도가 빨라진다.
 if ($board[bo_hide_comment]) $sql = " select * from $write_table $sql_order limit $from_record, $board[bo_page_rows] ";
    else $sql = " select * from $write_table where wr_is_comment = 0 $sql_order limit $from_record, $board[bo_page_rows] ";
}

5. lib/common.lib.php 에 검색 루틴 수정

// 검색 구문을 얻는다.
//function get_sql_search($search_ca_name, $search_field, $search_text, $search_operator=false)
function get_sql_search($search_ca_name, $search_field, $search_text, $search_operator='and')
{
    global $g4,$board; //board 추가


 //코멘트 사용안함의 경우.
    if ($not_comment && !$board[bo_hide_comment])
        $str .= " and wr_is_comment = '0' ";

 //echo $search_operator,$str;
    return $str;
}

 

댓글목록

등록된 댓글이 없습니다.

그누보드
190 (3/4P)

Search

Copyright © Cmd 명령어 18.224.66.196