通过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模板
这段时间比较忙,前些日子就看到了MT.org上的文章,现在才来这里说下。 MT要举行模板大赛了,MT5可以导出模板和大家分享,我相信在模板大赛之后,MT的模板会越来越多,那些曾经认为MT模板很难看而不用MT的,会不会再转到MT呢?这次模板大赛截止9月9日,中文MTer如果对CSS很熟悉的,也可以去参加一下,一等奖的奖品是Adobe Creative Suite 5 Web Premium,二等奖的奖品是iPad Wi-Fi (16GB)。 MT模板比赛的官方网站:http://www.mtcontest.jp/。…
MT 5.02发布了
MT 5.02发布了,和大家通告一声。 MT 5.02没有新功能,只是修复了一些bug,和一个潜在的危险,具体修复的请看这里。 6A推荐在使用MT5的用户去升级。 下载: MTOS MTP (需要爬墙)…
MT插件:MT-Twitter
Twitter现在大红大紫,我滞后很多,都没怎么好好去利用。Twitter的follow和Feed的订阅差不多,如果你发布了日志同时在Twitter通知大家,会给你的博客带来一定的流量。我找了一下,发现在MT平台下蛮早就有插件了:MT-Twitter。 功能简介|introduction: 在发布日志的时候,同时发布到Twitter上。…