QQ登录

只需一步,快速开始

终极精品

查看: 1943|回复: 0
打印 上一主题 下一主题

[cms教程] discuz:远程附件与本地附件的之间的转换教程

[复制链接]
[至尊红钻3级]发帖数量≥1000篇 [至尊黄钻5级]威望≥3000点 [至尊蓝钻3级]在线时间≥800小时 [至尊绿钻5级]贡献度≥3000点 [至尊紫钻6级]金币≥200000个 [未点亮至尊粉钻]精华贴数不足10贴 [未点亮至尊黑钻]活跃不足8个
 等级: 
 级别: 管理员
 UID:  1   [未点亮普号显示]钻石不足3个
 积 分: 407416
 威 望: 3806
 贡 献: 3745
 活 跃: 0
 发 贴: 1401 (4)
 终极币: 394653  
性 别: I'm 火星人!
阅读权限: 200
在线时长: 1151 小时
注册时间: 2014-7-25
最后登录: 2025-4-29
go
楼主
发表于 2020-5-1 23:30:33 |只看该作者 |倒序浏览

查看完整版请注册登录浏览

您需要 登录 才可以下载或查看,没有帐号?点击注册

x
最近本人因为想把阿里云OSS的远程附件搬到自己本地服务器上。最后图片啥的都搬回来准备妥当了,然而帖子图片却打不开了,显示的还是远程地址,最后去网上搜了下原因,才知道还要执行数据库升级,下面是操作教程!


第一步,使用FTP把本地 /data/attachment/ 目录下的文件下载到本地,这里我只用到了文件目录下的/forum,/portal和/block

                               
登录/注册后可看大图

第二步,FTP登录远程服务器。分别把下载下来的三个文件夹里的上传到远程服务器对应的目录里。


                               
登录/注册后可看大图

第三步,数据库执行sql语句,



论坛的:(0表示本地,1表示远程)

  1. update pre_forum_attachment_1 set remote=1 where remote=0; update pre_forum_attachment_2 set remote=1 where remote=0; update pre_forum_attachment_3 set remote=1 where remote=0; update pre_forum_attachment_4 set remote=1 where remote=0; update pre_forum_attachment_5 set remote=1 where remote=0; update pre_forum_attachment_6 set remote=1 where remote=0; update pre_forum_attachment_7 set remote=1 where remote=0; update pre_forum_attachment_8 set remote=1 where remote=0; update pre_forum_attachment_9 set remote=1 where remote=0;
复制代码
门户的:

  1. update pre_portal_article_title set remote=1 where remote=0; update pre_portal_attachment set remote=1 where remote=0; update pre_portal_topic_pic set remote=1 where remote=0;
复制代码
进入论坛后台,依次点击:站长-数据库-升级



                               
登录/注册后可看大图

把数据库升级语句复制到箭头方向,点击升级。(最好备份一下数据库)

之后更新网站缓存,进入网站随便点开一个之前附件在本地的帖子。邮件附件复制链接,如果链接地址和后台设置的远程访问 URL一致,表示迁移成功,就可以把本地的对应目录下的文件删除了。

之后更新网站缓存,进入网站随便点开一个之前附件在本地的帖子。邮件附件复制链接,如果链接地址和后台设置的远程访问 URL一致,表示迁移成功,就可以把本地的对应目录下的文件删除了。





                               
登录/注册后可看大图

以上是本地附件转换成远程附件的方法!如果以后不用远程附件了!只要反着操作就行了,比如数据库执行sql语句

  1. update pre_forum_attachment_1 set remote=0 where remote=1; update pre_forum_attachment_2 set remote=0 where remote=1; update pre_forum_attachment_3 set remote=0 where remote=1; update pre_forum_attachment_4 set remote=0 where remote=1; update pre_forum_attachment_5 set remote=0 where remote=1; update pre_forum_attachment_6 set remote=0 where remote=1; update pre_forum_attachment_7 set remote=0 where remote=1; update pre_forum_attachment_8 set remote=0 where remote=1; update pre_forum_attachment_9 set remote=0 where remote=1;
复制代码
  1. update pre_portal_article_title set remote=0 where remote=1; update pre_portal_attachment set remote=0 where remote=1; update pre_portal_topic_pic set remote=0 where remote=1;
复制代码
把0和1对掉下就OK了!很简单吧,记得收藏备用哟.


分享到: QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏0 支持支持0 反对反对0
宣传推广终极精品资源www.chnspy.com提升下载权限1...
您需要登录后才可以回帖 登录 | 点击注册

本版积分规则

QQ|Archiver|手机版|小黑屋|终极精品资源 ( 版权所有:广州汉鸿信息科技有限公司 粤ICP备15041466号

GMT+8, 2025-6-24 22:57 , Processed in 0.101742 second(s), 28 queries .

Powered by Discuz! X3.2

© 2015-2016 www.chnspy.com.

快速回复 返回顶部 返回列表