转载请注明出处: 皮哈皮阿
本文的链接地址: https://blog.phpat.com/web/447.html
emlog博客系统的官网在2017年6月底突然关闭了,疑似被攻击。具体还会不会恢复访问不得而知,没有官网和社区支持,再优秀的开源软件也会慢慢没落。再考虑到emlog已2-3年没有过更新,于是毅然决定将博客转为全球最为流行的wordpress,以下是迁移的过程。
以下步骤均假设自己的数据库名称为demo, 且命令是在MySQLWorkbench软件中连接到自己的数据库中执行的。且默认您的网站仅安装了emlog
首先将自己的emlog网站中的源码和数据备份到自己的电脑中,以防整个过程出错造成不可挽回的损失。备份完成后,删除除/content/uploadfile目录之外的所有文件
下载wordpress: https://cn.wordpress.org/
将wordpress的缘码上传到根目录
在浏览器中访问自己的网站地址https://www.demo.com/,页面会自动跳转到wordpress的安装界面
按要求填写相应信息,即可成功安装wordpress
数据库信息就填写安装emlog的数据库demo
安装好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目录的原因)。
迁移完成后, 需自己进入wordpress的后台, 设置下模板、网站信息、URL的形式、用户信息等即可正常访问自己的wordpress版博客。
本次迁移将文章信息,评论信息,分类信息等都迁移到wordpress中,丢弃了碎语,导航,设置,用户信息等跟wordpress不通用的信息。
转载请注明出处: 皮哈皮阿
本文的链接地址: https://blog.phpat.com/web/447.html
最近更新:更新到v2.5.7
请求中为数字/布尔的字段要多加注意,...
基于emlog开发的微信小程序
仿小米论坛版本更新V2.0,本次暂时...
element-ui el-tabl...
@子恒:😂躺平吧,世界都跟你没关系
你写得非常清晰明了,让我很容易理解你的观...
#Emlog插件RSS订阅器发布#
一直到今天,还没10天,我支付宝里仅剩7...
@樊鑫:不支持,仅支持pro版本,可以在...
#Beginning-Pro发布,Emlog-Pro + Beginning-Pro, 更Pro#
支持5.3吗?在哪里购买/下载?
#Beginning-Pro发布,Emlog-Pro + Beginning-Pro, 更Pro#
@叽叽:开源了的,https://git...
#vue.js组件之手写签名板vue-signature-simple#