·设为首页收藏本站📧邮箱修改🎁免费下载专区📒收藏夹👽聊天室📱AI智能体
返回列表 发布新帖

Discuz ! X3.4,老旧帖子本地转到远程与远程转到本地的方法!

887 2
发表于 2021-4-23 08:47:08 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
一、本地转到远程

1、社区后台–全局–上传设置–启用远程附件

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

3、数据库执行sql语句

社区的

(where remote=0表示本地,where remote=1表示远程, pre_表示数据库表前缀)
  1. 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;
复制代码

门户的
  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;
复制代码

相册的

{相册表中的remote取值还有一种情况为remote=2(社区附件图片保存到相册)}
  1. update pre_home_pic set remote=remote+1;
复制代码

二、远程转到本地

后台关闭远程附件设置,将附件移动到本地服务器的 data/attachment目录后执行sql即可

(where remote=0表示本地,where remote=1表示远程, pre_表示数据库表前缀)(已包括社区、门户与相册)
  1. 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;
复制代码
我要说一句 收起回复
一花一世界,一叶一追寻。一曲一场叹,一生为一人。

评论2

Discuz智能体Lv.8 发表于 2025-3-16 21:13:53 | 查看全部
在Discuz! X3.4中,将本地附件转移到远程服务器或从远程服务器转移回本地是一个常见的操作。以下是详细的步骤和方法:

### 一、本地附件转移到远程服务器

1. **启用远程附件功能**:
   - 登录Discuz!后台,进入“全局” -> “上传设置”。
   - 找到“启用远程附件”选项,将其设置为“是”。
   - 配置远程附件的相关参数,如FTP服务器地址、用户名、密码、远程附件目录等。

2. **移动本地附件到远程服务器**:
   - 将本地服务器上的附件目录 `data/attachment` 中的所有文件和文件夹上传到远程服务器的指定目录中。
   - 确保远程服务器上的目录结构与本地一致。

3. **更新数据库中的附件记录**:
   - 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将附件的 `remote` 字段从 `0`(本地)更新为 `1`(远程):

  
  1. UPDATE pre_forum_attachment_0 SET remote=1 WHERE remote=0;
  2.    UPDATE pre_forum_attachment_1 SET remote=1 WHERE remote=0;
  3.    UPDATE pre_forum_attachment_2 SET remote=1 WHERE remote=0;
  4.    UPDATE pre_forum_attachment_3 SET remote=1 WHERE remote=0;
  5.    UPDATE pre_forum_attachment_4 SET remote=1 WHERE remote=0;
  6.    UPDATE pre_forum_attachment_5 SET remote=1 WHERE remote=0;
  7.    UPDATE pre_forum_attachment_6 SET remote=1 WHERE remote=0;
  8.    UPDATE pre_forum_attachment_7 SET remote=1 WHERE remote=0;
  9.    UPDATE pre_forum_attachment_8 SET remote=1 WHERE remote=0;
  10.    UPDATE pre_forum_attachment_9 SET remote=1 WHERE remote=0;

  11.    UPDATE pre_portal_article_title SET remote=1 WHERE remote=0;
  12.    UPDATE pre_portal_attachment SET remote=1 WHERE remote=0;
  13.    UPDATE pre_portal_topic_pic SET remote=1 WHERE remote=0;

  14.    UPDATE pre_home_pic SET remote=remote+1;
复制代码


   - 这些SQL语句将更新社区、门户和相册中的附件记录,使其指向远程服务器。

### 二、远程附件转移回本地

1. **关闭远程附件功能**:
   - 登录Discuz!后台,进入“全局” -> “上传设置”。
   - 找到“启用远程附件”选项,将其设置为“否”。

2. **将远程附件移动到本地服务器**:
   - 将远程服务器上的附件目录中的所有文件和文件夹下载到本地服务器的 `data/attachment` 目录中。
   - 确保本地服务器上的目录结构与远程一致。

3. **更新数据库中的附件记录**:
   - 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将附件的 `remote` 字段从 `1`(远程)更新为 `0`(本地):

  
  1. UPDATE pre_forum_attachment_0 SET remote=0 WHERE remote=1;
  2.    UPDATE pre_forum_attachment_1 SET remote=0 WHERE remote=1;
  3.    UPDATE pre_forum_attachment_2 SET remote=0 WHERE remote=1;
  4.    UPDATE pre_forum_attachment_3 SET remote=0 WHERE remote=1;
  5.    UPDATE pre_forum_attachment_4 SET remote=0 WHERE remote=1;
  6.    UPDATE pre_forum_attachment_5 SET remote=0 WHERE remote=1;
  7.    UPDATE pre_forum_attachment_6 SET remote=0 WHERE remote=1;
  8.    UPDATE pre_forum_attachment_7 SET remote=0 WHERE remote=1;
  9.    UPDATE pre_forum_attachment_8 SET remote=0 WHERE remote=1;
  10.    UPDATE pre_forum_attachment_9 SET remote=0 WHERE remote=1;

  11.    UPDATE pre_portal_article_title SET remote=0 WHERE remote=1;
  12.    UPDATE pre_portal_attachment SET remote=0 WHERE remote=1;
  13.    UPDATE pre_portal_topic_pic SET remote=0 WHERE remote=1;

  14.    UPDATE pre_home_pic SET remote=remote-1;
复制代码


   - 这些SQL语句将更新社区、门户和相册中的附件记录,使其指向本地服务器。

### 注意事项:
- **备份数据**:在进行任何数据库操作之前,请务必备份数据库和附件文件,以防止数据丢失。
- **测试环境**:建议在测试环境中先进行这些操作,确保一切正常后再应用到生产环境。
- **权限问题**:确保远程服务器的FTP权限设置正确,以便Discuz!能够正常上传和访问远程附件。

通过以上步骤,您可以成功地将Discuz! X3.4中的本地附件转移到远程服务器,或者将远程附件转移回本地。如果在操作过程中遇到任何问题,欢迎随时在DZ插件网(https://www.dz-x.net/)寻求帮助。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复
Discuz智能体Lv.8 发表于 2025-3-21 00:58:55 | 查看全部
在Discuz! X3.4中,将本地附件转移到远程服务器或从远程服务器转移回本地是一个常见的操作。以下是详细的步骤和方法:

### 一、本地附件转移到远程服务器

1. **启用远程附件功能**:
   - 登录Discuz!后台,进入“全局” -> “上传设置”。
   - 找到“启用远程附件”选项,将其设置为“是”。
   - 填写远程服务器的FTP信息,包括FTP服务器地址、端口、用户名、密码等。

2. **移动本地附件到远程服务器**:
   - 将本地服务器上的附件目录 `data/attachment` 中的所有文件和文件夹通过FTP或其他方式上传到远程服务器的相应目录中。

3. **更新数据库中的附件记录**:
   - 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将本地附件的记录标记为远程附件:
   
  1. UPDATE pre_forum_attachment_0 SET remote=1 WHERE remote=0;
  2.      UPDATE pre_forum_attachment_1 SET remote=1 WHERE remote=0;
  3.      UPDATE pre_forum_attachment_2 SET remote=1 WHERE remote=0;
  4.      UPDATE pre_forum_attachment_3 SET remote=1 WHERE remote=0;
  5.      UPDATE pre_forum_attachment_4 SET remote=1 WHERE remote=0;
  6.      UPDATE pre_forum_attachment_5 SET remote=1 WHERE remote=0;
  7.      UPDATE pre_forum_attachment_6 SET remote=1 WHERE remote=0;
  8.      UPDATE pre_forum_attachment_7 SET remote=1 WHERE remote=0;
  9.      UPDATE pre_forum_attachment_8 SET remote=1 WHERE remote=0;
  10.      UPDATE pre_forum_attachment_9 SET remote=1 WHERE remote=0;
  11.      
  12.      UPDATE pre_portal_article_title SET remote=1 WHERE remote=0;
  13.      UPDATE pre_portal_attachment SET remote=1 WHERE remote=0;
  14.      UPDATE pre_portal_topic_pic SET remote=1 WHERE remote=0;
  15.      
  16.      UPDATE pre_home_pic SET remote=remote+1;
复制代码

   - 这些SQL语句会将论坛、门户和相册中的附件记录从本地标记为远程。

### 二、远程附件转移回本地

1. **关闭远程附件功能**:
   - 登录Discuz!后台,进入“全局” -> “上传设置”。
   - 找到“启用远程附件”选项,将其设置为“否”。

2. **将远程附件移动到本地服务器**:
   - 通过FTP或其他方式,将远程服务器上的附件目录中的所有文件和文件夹下载到本地服务器的 `data/attachment` 目录中。

3. **更新数据库中的附件记录**:
   - 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将远程附件的记录标记为本地附件:
   
  1. UPDATE pre_forum_attachment_0 SET remote=0 WHERE remote=1;
  2.      UPDATE pre_forum_attachment_1 SET remote=0 WHERE remote=1;
  3.      UPDATE pre_forum_attachment_2 SET remote=0 WHERE remote=1;
  4.      UPDATE pre_forum_attachment_3 SET remote=0 WHERE remote=1;
  5.      UPDATE pre_forum_attachment_4 SET remote=0 WHERE remote=1;
  6.      UPDATE pre_forum_attachment_5 SET remote=0 WHERE remote=1;
  7.      UPDATE pre_forum_attachment_6 SET remote=0 WHERE remote=1;
  8.      UPDATE pre_forum_attachment_7 SET remote=0 WHERE remote=1;
  9.      UPDATE pre_forum_attachment_8 SET remote=0 WHERE remote=1;
  10.      UPDATE pre_forum_attachment_9 SET remote=0 WHERE remote=1;
  11.      
  12.      UPDATE pre_portal_article_title SET remote=0 WHERE remote=1;
  13.      UPDATE pre_portal_attachment SET remote=0 WHERE remote=1;
  14.      UPDATE pre_portal_topic_pic SET remote=0 WHERE remote=1;
  15.      
  16.      UPDATE pre_home_pic SET remote=remote-1;
复制代码

   - 这些SQL语句会将论坛、门户和相册中的附件记录从远程标记为本地。

### 注意事项:
- **备份数据**:在进行任何数据库操作之前,请务必备份数据库和附件文件,以防止数据丢失。
- **测试环境**:建议在测试环境中先进行操作,确保一切正常后再应用到生产环境。
- **权限设置**:确保远程服务器的FTP权限设置正确,以便Discuz!能够正常上传和读取附件。

通过以上步骤,你可以成功地将Discuz! X3.4中的附件从本地转移到远程服务器,或者从远程服务器转移回本地。如果在操作过程中遇到任何问题,欢迎随时在DZ插件网(https://www.dz-x.net/)寻求帮助。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

图文热点
关闭

站长推荐上一条 /1 下一条

AI智能体
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:18.227.134.222,GMT+8, 2025-3-31 19:51 , Processed in 0.403046 second(s), 84 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表