冰古blog » wordpress » 2005 » 05 » 26 » Migrating from Drupal to WordPress-把Drupal转换为WordPress

Migrating from Drupal to WordPress-把Drupal转换为WordPress

WordPress没有从Drupal转换到Wordpress的程序,还是看看别人是怎么做的吧~学习学习
[提醒]切记,要先备份啊!!

I finally decided to move my greek blog from drupal to wordpress. Since there was no migration script, I wrote a couple of sql statements that moved all posts, comments and categories from my drupal tables to the (new) wordpress 1.5 tables.

Here is the proccess in short:

WARNING This may delete your DATA Make sure you backup EVERYTHING before starting the procedure

1. setup a fresh wordpress installation.
2. make sure term_data term_hierarchy node term_node comments (drupal tables) are in the same DB you use from WP.
3. Run the following SQL statements:

delete from weblog_wp_categories ;
delete from weblog_wp_posts;
delete from weblog_wp_post2cat ;
delete from weblog_wp_comments ;

insert into weblog_wp_categories(cat_ID,cat_name, category_nicename, category_description, category_parent) select term_data.tid, name, name, description, parent from term_data, term_hierarchy where term_data.tid=term_hierarchy.tid ;

INSERT INTO weblog_wp_posts(
ID, post_date, post_content, post_title, post_excerpt, post_name, post_modified
)

SELECT nid, FROM_UNIXTIME(created), body, title, teaser, concat(‘OLD’,nid), FROM_UNIXTIME(changed) FROM node WHERE type=’blog’ OR type=’page’ ;

INSERT INTO weblog_wp_post2cat (post_id,category_id) SELECT nid,tid FROM term_node ;

INSERT INTO weblog_wp_comments (
comment_post_ID, comment_date, comment_content, comment_parent
)

SELECT nid, FROM_UNIXTIME(timestamp), concat(‘‘,subject, ‘
‘, comment), thread FROM comments ;

You should now have all your posts and comments and categories in WP. Go to the admin interface and make sure everything is in place…

Notes: This is not the perfect way to migrate. Comments are not nested in the right way. A lot of things may not work. On the other hand if, like me, made a really simple use of Drupal, this should move most of your data to WP…

From:http://vrypan.net/log/archives/2005/03/10/migrating-from-drupal-to-wordpress/

Leave a Reply