사이트 내 전체검색
그누보드
검색목록
[튜닝] g5 읽기전용 게시판 최적화 처리 (비회원상태)
로빈아빠
https://cmd.kr/gnu/489 URL이 복사되었습니다.

본문

보여주기만 하는 사이트에서 최대속도 내게 (db 부하 최소)

 

회원함수 제거

/extend/_ar.denyfunction.php 

 

<?

if ($_SERVER[REMOTE_ADDR]=='관리자 ip') return;

if (strstr($PHP_SELF,'/login')) goto_url("/");

if (strstr($PHP_SELF,'/register')) goto_url("/");

if (strstr($PHP_SELF,'/confirm')) goto_url("/");

if (strstr($PHP_SELF,'/member')) goto_url("/");

if (strstr($PHP_SELF,'/password')) goto_url("/");

 

?> 

 

/lib/common.lib.php 에서 html_purifier(​) 스크립터 막음

 

//if($filter) $content = html_purifier($content); 

 

 

 

head.php 

//include_once(G5_PLUGIN_PATH.'/htmlpurifier/HTMLPurifier.standalone.php');

 

 

방문자수 db 처리 막음

// 방문자수의 접속을 남김

include_once(G5_BBS_PATH.'/visit_insert.inc.php');

 

// 일정 기간이 지난 DB 데이터 삭제 및 최적화

include_once(G5_BBS_PATH.'/db_table.optimize.php');

 

접속자 처리 막음..

/lib/common.lib.php

    function run()

    {

        global $config, $g5, $member;

/*

        // 현재접속자 처리

        $tmp_sql = " select count(*) as cnt from {$g5['login_table']} where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";

        $tmp_row = sql_fetch($tmp_sql);

 

        if ($tmp_row['cnt']) {

            $tmp_sql = " update {$g5['login_table']} set mb_id = '{$member['mb_id']}', lo_datetime = '".G5_TIME_YMDHIS."', lo_location = '{$g5['lo_location']}', lo_url = '{$g5['lo_url']}' where lo_ip = '{$_SERVER['REMOTE_ADDR']}' ";

            sql_query($tmp_sql, FALSE);

        } else {

            $tmp_sql = " insert into {$g5['login_table']} ( lo_ip, mb_id, lo_datetime, lo_location, lo_url ) values ( '{$_SERVER['REMOTE_ADDR']}', '{$member['mb_id']}', '".G5_TIME_YMDHIS."', '{$g5['lo_location']}',  '{$g5['lo_url']}' ) ";

            sql_query($tmp_sql, FALSE);

 

            // 시간이 지난 접속은 삭제한다

            sql_query(" delete from {$g5['login_table']} where lo_datetime < '".date("Y-m-d H:i:s", G5_SERVER_TIME - (60 * $config['cf_login_minutes']))."' ");

 

            // 부담(overhead)이 있다면 테이블 최적화

            //$row = sql_fetch(" SHOW TABLE STATUS FROM `$mysql_db` LIKE '$g5['login_table']' ");

            //if ($row['Data_free'] > 0) sql_query(" OPTIMIZE TABLE $g5['login_table'] ");

        }

*/

 

 

조회 수도 올리지 않음.

 

/bbs/board.php 

    // 한번 읽은글은 브라우저를 닫기전까지는 카운트를 증가시키지 않음

    $ss_name = 'ss_view_'.$bo_table.'_'.$wr_id;

    if (0 && !get_session($ss_name))

 

 

 

그룹관련 메뉴,권한이 필요없다면 그룹을 읽지 마라.

/common.php

if ($gr_id) {

    //$group = sql_fetch(" select * from {$g5['group_table']} where gr_id = '$gr_id' ");

}

 

 

 

 

 게시판일때 config 캐싱해서 읽기

 

/common.php

 

if ($bo_table) {

$cache_file = G5_DATA_PATH."/cache/latest-config-".G5_MYSQL_USER.G5_MYSQL_DB.".php";

if (file_exists($cache_file) && @filemtime($cache_file)>time()-3600) {

$config=unserialize(file_get_contents($cache_file));

}

else {

$config = sql_fetch(" select * from {$g5['config_table']} ");

file_put_contents($cache_file,serialize($config));

}

}

else {

$config = sql_fetch(" select * from {$g5['config_table']} ");

}

 

 

$board 도 캐싱하자..

관리자일때는 캐싱안함..

 

 

/common.php 

 

if ($bo_table) {

 

$cache_file = G5_DATA_PATH."/cache/latest-{$bo_table}-".G5_MYSQL_USER.G5_MYSQL_DB.".php";

 

if ($is_admin || !is_file($cache_file)) {

   $board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");

file_put_contents($cache_file,serialize($board));

}

else {

$board=unserialize(file_get_contents($cache_file));

}

 

 

 

댓글목록

등록된 댓글이 없습니다.

그누보드
24 (1/1P)

Search

Copyright © Cmd 명령어 3.128.199.175