테스트 사이트 - 개발 중인 베타 버전입니다

게시판 글 카운트 한번에 조정

· 2년 전 · 1905 · 2

php 초보라서..^^ 그냥 짜맞추기 식으로 만들었습니다^^

필요하신 분 있을 거 같아서!

 

버전 5.5.x 이상

후크형이 들어가서.. 혹시 이전버전은 run_event( ); 부분 제거하시면 될껍니다!

 

# adm/board_count_ref.php만들고 아래 내용 복붙

[code]

<?php
$sub_menu = '300830';
require_once './_common.php';

if ($is_admin != 'super') {
    alert('최고관리자만 접근 가능합니다.', G5_URL);
}

run_event('board_count_refrash_before');

$g5['title'] = '게시판 카운트 조정';
require_once './admin.head.php';
?>

<div class="local_desc02 local_desc">
    <p>
        완료 메세지가 나오기 전에 프로그램의 실행을 중지하지 마십시오.
    </p>
</div>

<?php
$sql = sql_query(" select bo_table from {$g5['board_table']} ");
while ($row = sql_fetch_array($sql)) {
    $write_table = $g5['write_prefix'].$row['bo_table'];
    sql_query(" update {$g5['board_table']} set bo_count_write = (select count(*) from {$write_table} where wr_is_comment = 0) where bo_table = '{$row['bo_table']}' ");
    sql_query(" update {$g5['board_table']} set bo_count_comment = (select count(*) from {$write_table} where wr_is_comment = 1) where bo_table = '{$row['bo_table']}' ");
}

run_event('board_count_refrash');

echo '<li>완료됨</li></ul>' . PHP_EOL;
echo '<div class="local_desc01 local_desc"><p><strong>모든 게시판에 카운트 조정이 완료 되었습니다.</strong><br>프로그램의 실행을 끝마치셔도 좋습니다.</p></div>' . PHP_EOL;
?>

<?php
require_once './admin.tail.php';

[/code]

 

# adm/admin.menu300.php

array('300820', '글,댓글 현황', G5_ADMIN_URL . '/write_count.php', 'scf_write_count'), 하단에 아래내용 추가

[code]
array('300830', '게시판 카운트 조정', G5_ADMIN_URL . '/board_count_ref.php', 'scf_board_count'),

[/code]

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 2개

2년 전
좋은 자료 감사합니다.
감사합니다

게시글 목록

번호 제목
24318
24317
24315
24309
24294
24293
24277
24262
24260
24253
24251
24236
24233
24228
24226
24221
24214
24203
24201
24199
24196
24195
24194
24192
24191
24187
24185
24183
24172
24168