emlog博客系统的官网在2017年6月底突然关闭了,疑似被攻击。具体还会不会恢复访问不得而知,没有官网和社区支持,再优秀的开源软件也会慢慢没落。再考虑到emlog已2-3年没有过更新,于是毅然决定将博客转为全球最为流行的wordpress,以下是迁移的过程。
以下步骤均假设自己的数据库名称为demo, 且命令是在MySQLWorkbench软件中连接到自己的数据库中执行的。且默认您的网站仅安装了emlog
1. 删除emlog
首先将自己的emlog网站中的源码和数据备份到自己的电脑中,以防整个过程出错造成不可挽回的损失。备份完成后,删除除/content/uploadfile目录之外的所有文件
2. 安装wordpress
下载wordpress: https://cn.wordpress.org/
将wordpress的缘码上传到根目录
在浏览器中访问自己的网站地址https://www.demo.com/,页面会自动跳转到wordpress的安装界面
按要求填写相应信息,即可成功安装wordpress
数据库信息就填写安装emlog的数据库demo
3. 将emlog数据库导入到wordpress数据库
安装好wordpress后,数据库中存在了emlog和wordpress两个系统的数据表,其中emlog的表前缀为emlog_(默认情况), wordpress的表前缀是wp_ (默认情况)
迁移文章数据
新建查询, 输入以下SQL语句 (先清空wp_posts表)
insert into demo.wp_posts( ID, post_author, post_title, post_date, post_date_gmt, post_content, post_excerpt, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered, post_type ) select gid as ID, author as post_author, title as post_title, FROM_UNIXTIME(date, '%Y-%m-%d %k:%i:%s' ) as post_date, FROM_UNIXTIME(date - 28800, '%Y-%m-%d %k:%i:%s' ) as post_date_gmt, content as post_content, excerpt as post_excerpt, FROM_UNIXTIME(date, '%Y-%m-%d %k:%i:%s' ) as post_modified, FROM_UNIXTIME(date - 28800, '%Y-%m-%d %k:%i:%s' ) as post_modified_gmt, concat('https://192.168.2.253:8099/?page_id=' , gid) as guid, (select count(*) as count from demo.emlog_comment where gid = ID and hide='n') as comment_count, '' as to_ping, '' as pinged, '' as post_content_filtered, if(type='blog', 'post', 'page') as post_type FROM demo.emlog_blog;
其中的 https://192.168.2.253:8099 为安装wordpress的域名地址, 运行完这句就导入好了文章数据
迁移评论数据
新建查询,输入一下SQL语句 (先清空wp_comments表) insert into demo.wp_comments(comment_ID, comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP,comment_date,comment_date_gmt,comment_content,comment_parent,comment_agent,comment_type) SELECT cid as comment_ID, gid as comment_post_ID, poster as comment_author, mail as comment_author_email, url as comment_author_url, ip as comment_author_IP, FROM_UNIXTIME(date, '%Y-%m-%d %k:%i:%s' ) as comment_date, FROM_UNIXTIME(date - 28800, '%Y-%m-%d %k:%i:%s' ) as comment_date_gmt, comment as comment_content, pid as comment_parent, '' as comment_agent, '' as comment_type FROM demo.emlog_comment;
迁移分类数据
新建查询,输入以下SQL语句 (先清空wp_terms表) insert into demo.wp_terms(term_id, name, slug) SELECT sid as term_id, sortname as name, alias as slug FROM demo.emlog_sort;
迁移分类与父分类的关系
新建查询,输入以下SQL语句 (先清空wp_term_taxonomy表) insert into demo.wp_term_taxonomy(term_id, taxonomy, description, parent, count) SELECT sid as term_id, 'category' as taxonomy, description, pid as parent, (select count(*) from demo.emlog_blog where sortid = term_id) as count FROM demo.emlog_sort;
迁移文章与分类的关系表
新建查询,输入以下SQL语句 (先清空wp_term_relationships表) insert into demo.wp_term_relationships(object_id, term_taxonomy_id) SELECT gid as object_id, (select term_taxonomy_id from demo.wp_term_taxonomy where term_id = sortid) as term_taxonomy_id FROM demo.emlog_blog where sortid != -1; 整个过程没有对文章中的附件做处理, 迁移过程中保持本地附件路径不变即可.(即第1步不删除/content/uploadfile目录的原因)。
4. 设置wordpress
迁移完成后, 需自己进入wordpress的后台, 设置下模板、网站信息、URL的形式、用户信息等即可正常访问自己的wordpress版博客。
5. 备注
本次迁移将文章信息,评论信息,分类信息等都迁移到wordpress中,丢弃了碎语,导航,设置,用户信息等跟wordpress不通用的信息。
本文发布于2017年07月03日16:35
,已经过了2853天,若内容或图片失效,请留言反馈
转载请注明出处: 皮哈皮阿
本文的链接地址: https://blog.phpat.com/dev/447.html
-
emlog主题模板 beginning 更新至v2.6.1
最近更新:更新到v2.5.7
2017/08/02
-
element-ui Radio 单选框组件默认值选不中?
请求中为数字/布尔的字段要多加注意,类型问题会导致很多bug出现。
2019/02/12
-
基于emlog开发的微信小程序开源了
基于emlog开发的微信小程序
2018/01/18
-
emlog模版仿小米论坛版本: V2.0
仿小米论坛版本更新V2.0,本次暂时更新这样了,以后会持续更新优化的。
2012/08/07
-
element-ui el-table 表格疯狂抖动跳动不停
element-ui el-table 表格疯狂抖动跳动不停, 这究竟是道德的沦丧还是人性的毁灭.~~
2019/07/11
-
Windows7程序图标无法锁定到任务栏的解决办法
2012/07/19

2017-07-22 09:03
emlog简约社区模版发布了。
今天的你,戴口罩了吗? 没戴?小心病毒安排你跳社会摇!🕺 记得勤洗手,冲掉坏运气~ 积极防护,保护自己,晴天咱们一起当人群里最靓的仔!✨
2019加油!钱包要鼓,头发要多,烦恼要少,快乐要爆。愿你工作摸鱼得潇洒,生活撒欢得漂亮!别怕,宇宙都在暗中支持你!
人生真的是多姿多彩
不是每朵白云,都会带来真情;不是每个拥抱,都会面带微笑;不是每次思念,都能立刻兑现;不是每个朋友,都在身边守候;不是每个日子,都逢良辰吉时。国庆节到了,愿你节日快乐!
昨天和今天有什么不同
经朋友提示,Beginning模板一周年了,恭喜。 好事总会发生,敬请期待更好的作品
beginning模板越来越好了[耶]
2018是个新的开始
“生命是属于每个人自己的感受,不属于任何别人的看法。”