<?php
//6、转换附件类型
truncatetable('forum_attachtype');

$query = $xc->db['source']->query("SELECT * FROM {$source_tablepre}attachtypes") or die("检索数据表 '{$source_tablepre}attachtypes' 错误！请将表 '{$source_tablepre}attachtypes' 字段类型为 nText 的改为 Text 类型。");

while ($a = $xc->db['source']->fetch_assoc($query)) {
	$a			= daddslashes(array_change_key_case($a));

	$id			= $a['id'];
	$extension	= $a['extension'];
	$maxsize	= $a['maxsize'];

	$fields1	= array('id', 'extension', 'maxsize');
	$query1		= getinsertsql("{$discuz_tablepre}forum_attachtype", $fields1);
	
	if ($xc->db['discuz']->query($query1)) {
		$convertedrows ++;
	} else {
		reportlog("插入 DZ 附件类型数据出错 id = $id extension = $extension");
	}
	$totalrows ++;
}

altertable('forum_attachtype', 'id');
?>