Jiniya

WEB

그누보드 G4 에서 G5로 이전후 첨부파일이 안나올 경우

그누보드 G4 에서 G5로 이전후 첨부파일이 안나올 경우G5버전에서 게시판마다 wr_file 필드가 생겼는데 이 필드값이 '0' 으로 되어 있어서 첨부파일이 안보이는 경우인데그누보드가 설치된 경로에서 file_check.php 파일 생성 후 실행 시키면 됩니다

PHP

      
<?
include_once('./_common.php');
if(!$is_admin) {
	exit;
}
$bo_table = "";
$sql = " select bo_table from $g5[board_table]";
$result = sql_query($sql);
for ($i=0; $row=sql_fetch_array($result); $i  ) 
{
	$result_file = sql_query("select distinct(wr_id) from $g5[board_file_table] where bo_table='$row[bo_table]'");
	for($j=0;$res=sql_fetch_array($result_file);$j  ) {
		$file_cnt = sql_fetch("select count(*) as cnt from $g5[board_file_table] where bo_table='$row[bo_table]' and wr_id='$res[wr_id]'");
		$bo_table = $g5['write_prefix'] . $row[bo_table];
		echo "update $bo_table set wr_file='$file_cnt[cnt]' where wr_id='$res[wr_id]'"."<br />";
		sql_query("update $bo_table set wr_file='$file_cnt[cnt]' where wr_id='$res[wr_id]'");
	}
}
echo "wr_file 필드에 파일수를 업데이트 하였습니다.";
?>