电影中心 精品软件 联系我们

古城技术联盟 发表于 2020-6-30 22:47:34

Discuz升级后(旧版本到3.2版本),发现抱歉,该附件无法读取的错误

报错信息:
抱歉,该附件无法读取

经排查,权限之类的完全正确。排查了数据库,发现数据升级时候丢掉了一些数据。
主要是这个表:pre_forum_attachment,丢掉了大部分附件所有数据。

解决办法:sql执行以下命令(有一个缺点,附件下载次数没有了)。如果想完全的恢复,只能恢复备份数据重新执行。
再次郑重说明,删除数据一定要谨慎,数据无价,谨慎操作。

INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,1,'10' FROM pre_forum_attachment_1 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,2,'10' FROM pre_forum_attachment_2 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,3,'10' FROM pre_forum_attachment_3 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,4,'10' FROM pre_forum_attachment_4 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,5,'10' FROM pre_forum_attachment_5 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,6,'10' FROM pre_forum_attachment_6 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,7,'10' FROM pre_forum_attachment_7 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,8,'10' FROM pre_forum_attachment_8 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
INSERT INTO pre_forum_attachment(aid,tid,pid, uid,tableid,downloads)SELECT aid,tid,pid, uid,9,'10' FROM pre_forum_attachment_9 d WHERE NOT EXISTS (select tid from pre_forum_attachment where pre_forum_attachment.aid = d.aid);
页: [1]
查看完整版本: Discuz升级后(旧版本到3.2版本),发现抱歉,该附件无法读取的错误