DZ升级到X2.5 附件变问号的原因及处理方案

首先我们先来查看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的数据之后 请确保这些表都存在

不允许评论