<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mike Smullin &#187; WordPress</title>
	<atom:link href="http://www.mikesmullin.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mikesmullin.com</link>
	<description>Personal Blog</description>
	<lastBuildDate>Sat, 31 Jul 2010 00:06:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Migrate/Convert/Import Drupal 5.x to WordPress 2.7</title>
		<link>http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/</link>
		<comments>http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 03:45:57 +0000</pubDate>
		<dc:creator>Mike Smullin</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.mikesmullin.com/?p=58</guid>
		<description><![CDATA[So back in 2006 Drupal 5.x was introducing some cool new features to the open-source scene that had me wondering about the future of WordPress. Fast-forward to 2009, and WordPress has made some major changes since 2.5 that have made blogging fun again. Hooray! As trends continue to boom and bust, and creative masses are]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.mikesmullin.com/wp-content/uploads/2009/02/drupal-to-wordpress.png" alt="drupal-to-wordpress" title="drupal-to-wordpress" width="150" height="150" class="alignright size-full wp-image-76" />So back in 2006 Drupal 5.x was introducing some cool new features to the open-source scene that had me wondering about the future of WordPress. Fast-forward to 2009, and WordPress has made some major changes since 2.5 that have made blogging fun again. Hooray! As trends continue to boom and bust, and creative masses are moving from technology to the next, the ability to take your content with you is invaluable. Here&#8217;s how I did it.</p>
<p><span id="more-58"></span></p>
<p>I debated whether I should post this because there are already <a href="http://codex.wordpress.org/Importing_Content#Drupal">at</a> <a href="http://spindrop.us/2006/05/19/migrating-from-drupal-47-to-wordpress">least</a> <a href="http://www.rufuspollock.org/archives/62">five</a> <a href="http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/">other</a> <a href="http://dovdox.com/content/archives/135">guides</a> at the time of this writing. But while D’Arcy&#8217;s was the most recent, a number of things had changed to where it still needed some tweaking to get right. I figured time is money and any time-saving tips are worthwhile. Hopefully this helps you at least for the next few versions of these platforms.</p>
<p><strong>Note:</strong> While this gets you pretty darn close, you&#8217;ll still want to know a little about <acronym title="Structured Query Language">SQL</acronym>, Drupal, and WordPress to customize this to fit your installation. Since Drupal was designed to be a <acronym title="Content Management System">CMS</acronym>, not specific to blogging, there are multiple ways you could have configured the site to operate as a blog. Not knowing your setup ahead of time, I&#8217;m just going to show you mine. Here&#8217;s the <acronym title="Structured Query Language">SQL</acronym> script to handle the import and conversion:</p>
<pre><code>
# Changelog

# 02.06.2009 - Updated by Mike Smullin http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/
# 05.15.2007 - Updated by D’Arcy Norman http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/
# 05.19.2006 - Created by Dave Dash http://spindrop.us/2006/05/19/migrating-from-drupal-47-to-wordpress/

# 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, '<!--break-->', '<!--more-->');
# fix images in post content
UPDATE wordpress.wp_posts SET post_content = REPLACE(post_content, '"/files/', '"/wp-content/uploads/');
</code></pre>
<p><strong>Things to be aware of:</strong></p>
<ul>
<li>Always backup first, and don&#8217;t try this on a live server.</li>
<li>Rename wordpress and drupal to the actual names of your databases.</li>
<li>Remember to move your images from ./files into the ./wp-content/uploads directory. My Drupal ./files directory followed the same ./YYYY/MM/DD/filename <acronym title="Uniform Resource Locator">URL</acronym> structure for blog post images and attachments but yours may need to be manually renamed.</li>
<li>You&#8217;ll likely need to use the WordPress Redirection plugin to preserve any link juice from your old permalink structure, where any changes occur.</li>
</ul>

<div class="shr-bookmarks shr-bookmarks-expand shr-bookmarks-center shr-bookmarks-bg-caring-old">
<ul class="socials">
		<li class="shr-blogger">
			<a href="http://www.blogger.com/blog_this.pyra?t&amp;u=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;n=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7&amp;pli=1" rel="nofollow" class="external" title="Blog this on Blogger">Blog this on Blogger</a>
		</li>
		<li class="shr-delicious">
			<a href="http://delicious.com/post?url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Share this on del.icio.us">Share this on del.icio.us</a>
		</li>
		<li class="shr-digg">
			<a href="http://digg.com/submit?phase=2&amp;url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Digg this!">Digg this!</a>
		</li>
		<li class="shr-facebook">
			<a href="http://www.facebook.com/share.php?v=4&amp;src=bm&amp;u=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;t=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Share this on Facebook">Share this on Facebook</a>
		</li>
		<li class="shr-googlebookmarks">
			<a href="http://www.google.com/bookmarks/mark?op=add&amp;bkmk=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Add this to Google Bookmarks">Add this to Google Bookmarks</a>
		</li>
		<li class="shr-googlebuzz">
			<a href="http://www.google.com/buzz/post?url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;imageurl=" rel="nofollow" class="external" title="Post on Google Buzz">Post on Google Buzz</a>
		</li>
		<li class="shr-linkedin">
			<a href="http://www.linkedin.com/shareArticle?mini=true&amp;url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7&amp;summary=So%20back%20in%202006%20Drupal%205.x%20was%20introducing%20some%20cool%20new%20features%20to%20the%20open-source%20scene%20that%20had%20me%20wondering%20about%20the%20future%20of%20WordPress.%20Fast-forward%20to%202009%2C%20and%20WordPress%20has%20made%20some%20major%20changes%20since%202.5%20that%20have%20made%20blogging%20fun%20again.%20Hooray%21%20As%20trends%20continue%20to%20boom%20and%20bust%2C%20an&amp;source=Mike Smullin" rel="nofollow" class="external" title="Share this on LinkedIn">Share this on LinkedIn</a>
		</li>
		<li class="shr-myspace">
			<a href="http://www.myspace.com/Modules/PostTo/Pages/?u=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;t=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Post this to MySpace">Post this to MySpace</a>
		</li>
		<li class="shr-reddit">
			<a href="http://reddit.com/submit?url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Share this on Reddit">Share this on Reddit</a>
		</li>
		<li class="shr-stumbleupon">
			<a href="http://www.stumbleupon.com/submit?url=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/&amp;title=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7" rel="nofollow" class="external" title="Stumble upon something good? Share it on StumbleUpon">Stumble upon something good? Share it on StumbleUpon</a>
		</li>
		<li class="shr-technorati">
			<a href="http://technorati.com/faves?add=http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/" rel="nofollow" class="external" title="Share this on Technorati">Share this on Technorati</a>
		</li>
		<li class="shr-twitter">
			<a href="http://twitter.com/home?status=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7+-+http://b2l.me/dc43q&amp;source=shareaholic" rel="nofollow" class="external" title="Tweet This!">Tweet This!</a>
		</li>
		<li class="shr-yahoomail">
			<a href="http://compose.mail.yahoo.com/?Subject=Migrate%2FConvert%2FImport+Drupal+5.x+to+WordPress+2.7&amp;body=Link: http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/ (sent via shareaholic)%0D%0A%0D%0A----%0D%0A So%20back%20in%202006%20Drupal%205.x%20was%20introducing%20some%20cool%20new%20features%20to%20the%20open-source%20scene%20that%20had%20me%20wondering%20about%20the%20future%20of%20WordPress.%20Fast-forward%20to%202009%2C%20and%20WordPress%20has%20made%20some%20major%20changes%20since%202.5%20that%20have%20made%20blogging%20fun%20again.%20Hooray%21%20As%20trends%20continue%20to%20boom%20and%20bust%2C%20an" rel="nofollow" class="external" title="Email this via Yahoo! Mail">Email this via Yahoo! Mail</a>
		</li>
</ul>
<div style="clear:both;"></div>
</div>

]]></content:encoded>
			<wfw:commentRss>http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
