Discuz ! X3.4,老旧帖子本地转到远程与远程转到本地的方法!
一、本地转到远程1、社区后台–全局–上传设置–启用远程附件
2、将本地附件目录data/attachment里面的文件夹移动到远程服务器上
3、数据库执行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;
二、远程转到本地
后台关闭远程附件设置,将附件移动到本地服务器的 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; 在Discuz! X3.4中,将本地附件转移到远程服务器或从远程服务器转移回本地是一个常见的操作。以下是详细的步骤和方法:
### 一、本地附件转移到远程服务器
1. **启用远程附件功能**:
- 登录Discuz!后台,进入“全局” -> “上传设置”。
- 找到“启用远程附件”选项,将其设置为“是”。
- 配置远程附件的相关参数,如FTP服务器地址、用户名、密码、远程附件目录等。
2. **移动本地附件到远程服务器**:
- 将本地服务器上的附件目录 `data/attachment` 中的所有文件和文件夹上传到远程服务器的指定目录中。
- 确保远程服务器上的目录结构与本地一致。
3. **更新数据库中的附件记录**:
- 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将附件的 `remote` 字段从 `0`(本地)更新为 `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;
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;
UPDATE pre_home_pic SET remote=remote+1;
- 这些SQL语句将更新社区、门户和相册中的附件记录,使其指向远程服务器。
### 二、远程附件转移回本地
1. **关闭远程附件功能**:
- 登录Discuz!后台,进入“全局” -> “上传设置”。
- 找到“启用远程附件”选项,将其设置为“否”。
2. **将远程附件移动到本地服务器**:
- 将远程服务器上的附件目录中的所有文件和文件夹下载到本地服务器的 `data/attachment` 目录中。
- 确保本地服务器上的目录结构与远程一致。
3. **更新数据库中的附件记录**:
- 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将附件的 `remote` 字段从 `1`(远程)更新为 `0`(本地):
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;
- 这些SQL语句将更新社区、门户和相册中的附件记录,使其指向本地服务器。
### 注意事项:
- **备份数据**:在进行任何数据库操作之前,请务必备份数据库和附件文件,以防止数据丢失。
- **测试环境**:建议在测试环境中先进行这些操作,确保一切正常后再应用到生产环境。
- **权限问题**:确保远程服务器的FTP权限设置正确,以便Discuz!能够正常上传和访问远程附件。
通过以上步骤,您可以成功地将Discuz! X3.4中的本地附件转移到远程服务器,或者将远程附件转移回本地。如果在操作过程中遇到任何问题,欢迎随时在DZ插件网(https://www.dz-x.net/)寻求帮助。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。 在Discuz! X3.4中,将本地附件转移到远程服务器或从远程服务器转移回本地是一个常见的操作。以下是详细的步骤和方法:
### 一、本地附件转移到远程服务器
1. **启用远程附件功能**:
- 登录Discuz!后台,进入“全局” -> “上传设置”。
- 找到“启用远程附件”选项,将其设置为“是”。
- 填写远程服务器的FTP信息,包括FTP服务器地址、端口、用户名、密码等。
2. **移动本地附件到远程服务器**:
- 将本地服务器上的附件目录 `data/attachment` 中的所有文件和文件夹通过FTP或其他方式上传到远程服务器的相应目录中。
3. **更新数据库中的附件记录**:
- 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将本地附件的记录标记为远程附件:
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;
UPDATE pre_home_pic SET remote=remote+1;
- 这些SQL语句会将论坛、门户和相册中的附件记录从本地标记为远程。
### 二、远程附件转移回本地
1. **关闭远程附件功能**:
- 登录Discuz!后台,进入“全局” -> “上传设置”。
- 找到“启用远程附件”选项,将其设置为“否”。
2. **将远程附件移动到本地服务器**:
- 通过FTP或其他方式,将远程服务器上的附件目录中的所有文件和文件夹下载到本地服务器的 `data/attachment` 目录中。
3. **更新数据库中的附件记录**:
- 登录数据库管理工具(如phpMyAdmin),执行以下SQL语句,将远程附件的记录标记为本地附件:
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;
- 这些SQL语句会将论坛、门户和相册中的附件记录从远程标记为本地。
### 注意事项:
- **备份数据**:在进行任何数据库操作之前,请务必备份数据库和附件文件,以防止数据丢失。
- **测试环境**:建议在测试环境中先进行操作,确保一切正常后再应用到生产环境。
- **权限设置**:确保远程服务器的FTP权限设置正确,以便Discuz!能够正常上传和读取附件。
通过以上步骤,你可以成功地将Discuz! X3.4中的附件从本地转移到远程服务器,或者从远程服务器转移回本地。如果在操作过程中遇到任何问题,欢迎随时在DZ插件网(https://www.dz-x.net/)寻求帮助。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
页:
[1]