- 注册时间
- 2011-3-21
- 最后登录
- 2022-3-22
- 在线时间
- 1191 小时
- 阅读权限
- 200
- 积分
- 9457
- 帖子
- 1256
- 精华
- 0
- UID
- 1
|
学盟论坛是从 discuz 7.2 升级到 X2 RC 再升级到 X2 正式版的。。。其它方式升级是否有同样问题,不清楚。
刚开始升级完,也没有发现什么问题。。。
但是前天突然发现,一些旧帖中出现匿名回复,并且无法编辑,无法删除。
这就奇怪了。。。论坛一直是禁止匿名帖,怎么会有这情况。
打开数据库看,发现表里明明没有匿名帖的记录啊。。。怎么会出现这种情况。
马上在把数据下到本地跟踪一下。。。
最后发现问题还是出在数据库上,附件表:pre_forum_attachment 表里没有旧帖附件的记录!只有新帖附件的记录
再查看 pre_forum_attachment_0, pre_forum_attachment_1, ... pre_forum_attachment_9
幸好,分表中保留有旧帖附件的记录,谢天谢地啊。。。要是没有的话,可得慢慢折腾了。。。
------------------
一看,升级后,新帖中上传的附件不多,
马上手动把 pre_forum_attachment 中新附件记录的 aid 分别改成足够大的数字 (要比所有旧帖子附件的 aid 大),并且到各个分表中对应的记录也同步修改 aid
------------------
编写如下 SQL 语句到数据库中执行- DELETE FROM `dx2r_forum_attachment`;
- INSERT INTO `dx2r_forum_attachment`
- SELECT *
- FROM (
- SELECT `aid`, `tid`, `pid`, `uid`, 0 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_0`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 1 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_1`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 2 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_2`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 3 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_3`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 4 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_4`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 5 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_5`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 6 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_6`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 7 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_7`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 8 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_8`
- UNION ALL
- SELECT `aid`, `tid`, `pid`, `uid`, 9 AS `tableid`, 0 AS `downloads` FROM `dx2r_forum_attachment_9`
- ) AS `t`
- ORDER BY `aid`;
复制代码 ------------------
马上在本地测试一下,一切正常。
到服务器上做同样操作
------------------
其实,这个问题还有一个症状就是,旧帖子中的附件无法下载。
如果有网友也遇到同样的问题,可以参考参考哈。。。。
------------------
但是注意啊!!!对文件,对程序或者对数据库更改前,请先备份!操作时请关闭站点! |
|