通过SQL语句转移MovableType到WordPress

| 0 Comments | Previous | Next | EDIT

如果博客很大,通过后台的导出和导入转移博客很不方便,因为文件太大。今天在网络上看到一篇日志SQL script to migrate from Movable Type to WordPress,我觉得这个方法不错!

该SQL脚本在MovableType 5.01和WordPress 2.92下经过作者的测试,当版本升级之后,不一定能顺利转移。在使用下面代码之前,修改自己的WordPressMovableType的数据库名字。

USE `WordPress`;
 
/*  !!! Truncate tables to prevent primary key conflicts !!! */
TRUNCATE TABLE wp_posts;
TRUNCATE TABLE wp_comments;
TRUNCATE TABLE wp_users;
 
/* users from author */
INSERT INTO wp_users (
ID,
user_login,
user_pass,
user_nicename,
user_email,
user_url,
user_registered,
/* user_activation_key, */
user_status,
display_name
 
) (SELECT
author_id,
author_name,
author_password, /* fingers crossed */
IF (author_basename IS NOT NULL,author_basename,author_name) ,
author_email,
IF (author_url IS NOT NULL,author_url,' '),
author_created_on,
/* user_activation_key, */
author_status,
IF (author_nickname IS NOT NULL,author_nickname,author_name)
FROM MTDATABASE.mt_author);
 
/*  post from entry */
INSERT INTO wp_posts (
ID,
post_author,
post_date,
post_date_gmt,
post_content,
post_title,
post_excerpt,
post_status,
comment_status,
ping_status,
/* post_password  */
post_name,
post_modified,
post_modified_gmt, /* --post_modified_gmt,  */
/* --post_content_filter,  */
/* --post_parent,  */
/* --guid,  */
/* --menu_order,  */
/* --post_type,  */
/* --post_mime_type,  */
comment_count,
to_ping,
pinged 
) (
SELECT
entry_id,
entry_author_id,
entry_created_on,
CONVERT_TZ(entry_created_on,'+00:00','-06:00'), /* GMT */
CONCAT(entry_text,entry_text_more) ,
entry_title,
entry_excerpt,
TRIM(CAST(entry_status AS CHAR)),
TRIM(CAST(entry_allow_comments AS CHAR)),
TRIM(CAST(entry_allow_pings AS CHAR)),
/* --post_password  */
entry_basename,
/* --to_ping  */
/* --pinged  */
entry_modified_on,
CONVERT_TZ(entry_modified_on,'+00:00','-06:00'), /* -- post_modified_gmt,  */
/* --post_content_filter,  */
/* --post_parent,  */
/* --guid,  */
/* --menu_order,  */
/* --post_type,  */
/* --post_mime_type,  */
entry_comment_count,
'',
''
FROM mises_blog.mt_entry);
 
 
INSERT INTO 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_karma, junk_score? */
/* comment_approved, comment_junk_status?? */
/* comment_agent, */
/* comment_type, */
comment_parent,
user_id
) ( SELECT
comment_id,
comment_entry_id,
comment_author,
comment_email,
comment_url,
comment_ip,
comment_created_on,
CONVERT_TZ(comment_created_on,'+00:00','-06:00'), /* comment_date_gmt, */
comment_text,
/* comment_karma, */
/* comment_approved, */
/* comment_agent, */
/* comment_type, */
comment_parent_id,
comment_created_by
FROM mises_blog.mt_comment WHERE comment_junk_status = 1);
 
 
UPDATE wp_posts SET post_status = 'publish', comment_status='open', ping_status='open';
 
/* Specific to our DB: */
 
UPDATE wordpress.wp_posts SET guid = CONCAT('http://blog.mises.org/archives/', RIGHT(CONCAT('000000', ID),6), ".asp");

评论

推荐主机

Bluhost空间租用        MediaTemple空间租用

Recent Entries

MT 5.1发布, 5.05 和 4.36更新
刚刚看到MT.org的文章,MT5.1发布了。 怎么冒出了一个MT5.05版本,我发现我测试的那个还是使用MT5.01的,如果你不想升级到5.1的话,5.01可以升级到5.05吗?我是这样理解的。 MT5.05和MT4.36是安全更新,强烈建议大家更新。 下面界面MT5的官方PPT,里面介绍了MT5.1的一些新功能。拖拉来管理分类这个功能不错,虽然我们不常去改变,如果一个博客下有很多的分类,用这种方法就方便多了,除外,MT5.1也新增了一些MTML标签。…
MT 5.1 Beta 1发布
MT 5.1 Beta 1 今天发布了,在接下来的三个月左右时间里,SAKK会每隔两个星期左右发布一个Beta版本,等程序稳定了,就发布RC版本,第一个RC版本大概在五月中旬发布。 下载MT 5.1 Beta 1 Beta Builds MTOS nightly builds Source Code 更多信息请查看MT.org的日志。…
6A日本公司被Infocom收购
刚刚从6A的官方网站上看到,Six Apart KK(SAY日本子公司)被Infocom收购了。收购之后,全球的Movable Type(MT)的业务就交给SAKK管理了,并且运营Six Apart这个品牌。 在的收购公示里,粗略谈到了Movable Type以后的一些发展,比如更好地整合Twitter等社会化应用。希望SAKK被Infocom收购之后,能够更好地完善Movable Type。公示的英文简版请看:Six Apart Japan to be acquired by Infocom and assume responsibility for Movable…