首先我們先來檢視 update.php 檔案中處理附件部分程式碼
elseif($_GET[‘op’] == ‘forumattach’) {
$nextop = ‘moderate’;
$limit = 10000;
$start = !empty($_GET[‘start’]) ? $_GET[‘start’] : 0;
$needupgrade = DB::query(“SELECT COUNT(*) FROM “.DB::table(‘forum_attachmentfield’), ‘SILENT’);
$count = DB::result_first(“SELECT COUNT(*) FROM “.DB::table(‘forum_attachment’));
if($needupgrade && $count) {
if(!$start) {
for($i = 0;$i < 10;$i++) {
DB::query(“TRUNCATE “.DB::table(‘forum_attachment_’.$i));
}
}
$query = DB::query(“SELECT a.*,af.description FROM “.DB::table(‘forum_attachment’).” a
LEFT JOIN “.DB::table(‘forum_attachmentfield’).” af USING(aid)
ORDER BY aid LIMIT $start, $limit”);
if(DB::num_rows($query)) {
省略。。。。。。。
$needupgrade = DB::query(“SELECT COUNT(*) FROM “.DB::table(‘forum_attachmentfield’), ‘SILENT’);
程式碼紅色部分,有對 forum_attachmentfield 進行處理,因為這個升級程式是相容 Discuz! X 系列的升級。如果你升級到 X2 的時候此表還存在,升級到 Discuz! X2.5 就會將附件表 forum_attachment_0 到 9 這些表給處理掉。正常情況 Discuz! X2 升級到 Discuz! X2.5 是不用處理附件表。 所以,升級到 X2.5 附件為 問號的使用者,可以直接匯入 X2 備份的資料將附件表 forum_attachment 和 forum_attachment_0 到 9 表 、 forum_attachment_unused 表的資料直接匯入
X2.5 的附件表 有對 forum_attachment_type 更改 、新增 了 forum_attachment_exifi 表,匯入 X2 的資料之後 請確保這些表都存在