MIA
Jan31Sorry for the lack of posting here, but I have been learning how to move a website form Drupal to Word Press
Oh it was so much fun, with not a whole lot of guides to work on. Importing a Drupal blog into Word Press is not easy, but in ome ways it was easier than I thought. After finding a few guides on some blogs it was not that hard. But since I am importign into a WPMU blog, it was a little trickier than just into a regular Wordpress blog.
These are the 2 blog I used:
Social CMS Buzz
Mike Smullin
Here are the steps I used:
# This assumes that both wordpress and drupal are in separate databases. The wordpress database is called “wordpress” and the Drupal database is called “drupal”
# first, nuke previous content in wordpress database
TRUNCATE TABLE wordpress.wp_comments;
TRUNCATE TABLE wordpress.wp_links;
TRUNCATE TABLE wordpress.wp_postmeta;
TRUNCATE TABLE wordpress.wp_posts;
TRUNCATE TABLE wordpress.wp_term_relationships;
TRUNCATE TABLE wordpress.wp_term_taxonomy;
TRUNCATE TABLE wordpress.wp_terms;# categories
INSERT INTO wordpress.wp_terms (term_id, `name`, slug, term_group)
SELECT
d.tid, d.name, REPLACE(LOWER(d.name), ‘ ‘, ‘_’), 0
FROM drupal.term_data d
INNER JOIN drupal.term_hierarchy h
USING(tid)
;INSERT INTO wordpress.wp_term_taxonomy (term_id, taxonomy, description, parent)
SELECT
d.tid `term_id`,
‘category’ `taxonomy`,
d.description `description`,
h.parent `parent`
FROM drupal.term_data d
INNER JOIN drupal.term_hierarchy h
USING(tid)
;# posts; keeping private posts hidden
INSERT INTO wordpress.wp_posts (id, post_date, post_content, post_title, post_excerpt, post_name, post_modified, post_type, `post_status`)
SELECT DISTINCT
n.nid `id`,
FROM_UNIXTIME(n.created) `post_date`,
r.body `post_content`,
n.title `post_title`,
r.teaser `post_excerpt`,
IF(SUBSTR(a.dst, 11, 1) = ‘/’, SUBSTR(a.dst, 12), a.dst) `post_name`,
FROM_UNIXTIME(n.changed) `post_modified`,
n.type `post_type`,
IF(n.status = 1, ‘publish’, ‘private’) `post_status`
FROM drupal.node n
INNER JOIN drupal.node_revisions r
USING(vid)
LEFT OUTER JOIN drupal.url_alias a
ON a.src = CONCAT(‘node/’, n.nid)
WHERE n.type IN (‘post’, ‘page’)
;# post -> category relationships
INSERT INTO wordpress.wp_term_relationships (object_id, term_taxonomy_id)
SELECT nid, tid FROM drupal.term_node;# category count updating
UPDATE wp_term_taxonomy tt
SET `count` = (
SELECT COUNT(tr.object_id)
FROM wp_term_relationships tr
WHERE tr.term_taxonomy_id = tt.term_taxonomy_id
);# comments; keeping unapproved comments hidden
INSERT INTO wordpress.wp_comments (comment_post_ID, comment_date, comment_content, comment_parent, comment_author, comment_author_email, comment_author_url, comment_approved)
SELECT nid, FROM_UNIXTIME(timestamp), comment, thread, name, mail, homepage, status FROM drupal.comments;# update comments count on wp_posts table
UPDATE `wp_posts` SET `comment_count` = (SELECT COUNT(`comment_post_id`) FROM `wp_comments` WHERE `wp_posts`.`id` = `wp_comments`.`comment_post_id`);# fix breaks in post content
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content, ”, ”);
# fix images in post content
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content, ‘”/files/’, ‘”/wp-content/uploads/’);UPDATE wordpress.wp_comments set comment_approved = (comment_approved + 1) % 2;
Basically I imported the drupal db into the wp db and used the same db, made it easier especially since I was testing it on a different server than where the drupal db is at.
And to add this to a WPMU blog you export the new WP blog that I made, and split the .xnl files into smaller chunks to import into the WPMU blog.
So much fun.
No related posts.


Comments
Tweets that mention MIA » Business & Technology - Brought to you by 73wire.com -- Topsy.com says:
February 3, 2010 at 2:51 am[...] This post was mentioned on Twitter by ljarratt, 73 Wire. 73 Wire said: Biz & Tech Update: MIA http://bit.ly/dpAmpD #73wire [...]