Discuz!X3.4本地附件修改为远程附件的方法(DiscuzX系列版本附件地址远程本地互转SQL升级语句大全)

0oD三一o0

温馨提示:这篇文章已超过665天没有更新,请注意相关的内容是否还可用!

一、本地转到远程

1.论坛后台–全局–上传设置–启用远程附件

2.将本地附件目录data/attachment里面的文件夹移动到远程服务器上

3.数据库执行sql语句


※如果论坛管理后台未开启执行SQL升级语句功能可以按照如下方式开启

1.打开网站根目录/config/config_global.php文件;

2.大约在96行附近找到如下代码,将“0”改为“1”即为开启后台SQL语句功能;

$_config['admincp']['runquery'] = '1';

Discuz!X3.4本地附件修改为远程附件的方法(DiscuzX系列版本附件地址远程本地互转SQL升级语句大全)

3.保存文件后再次尝试在论坛管理后台执行相关SQL命令即可。

Discuz!X3.4本地附件修改为远程附件的方法(DiscuzX系列版本附件地址远程本地互转SQL升级语句大全)

论坛附件转换为远程附件

(where remote=0表示本地,where remote=1表示远程, pre_表示数据库表前缀)

update pre_forum_attachment_0 set remote=1 where remote=0;
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;

门户附件转换为远程附件

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;


相册附件转换为远程附件

{相册表中的remote取值还有一种情况为remote=2(论坛附件图片保存到相册)}

update pre_home_pic set remote=remote+1;


二、远程附件转到本地附件

执行此操作前请务必登陆Discuz论坛管理后台关闭远程附件设置,并将附件移动到本地服务器的 data/attachment目录后方可执行以下SQL语句。

(where remote=0表示本地,where remote=1表示远程, pre_表示数据库表前缀)

update pre_forum_attachment_0 set remote=0 where remote=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;
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;
update pre_home_pic set remote=remote-1;


免责声明:本文来自书画家郑路迅,不代表0oD三一o0的观点和立场,如有侵权请联系本平台处理。

发表评论

快捷回复: 表情:
AddoilApplauseBadlaughBombCoffeeFabulousFacepalmFecesFrownHeyhaInsidiousKeepFightingNoProbPigHeadShockedSinistersmileSlapSocialSweatTolaughWatermelonWittyWowYeahYellowdog
评论列表 (暂无评论,781人围观)

还没有评论,来说两句吧...

取消
微信二维码
微信二维码
支付宝二维码