<?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>andremiller.net &#187; Wordpress</title>
	<atom:link href="http://www.andremiller.net/tag/wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://www.andremiller.net</link>
	<description>Andre Miller</description>
	<lastBuildDate>Tue, 24 Mar 2009 13:08:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting from Drupal 5.5 to Wordpress 2.7.1</title>
		<link>http://www.andremiller.net/content/converting-from-drupal-55-to-wordpress-271</link>
		<comments>http://www.andremiller.net/content/converting-from-drupal-55-to-wordpress-271#comments</comments>
		<pubDate>Thu, 19 Mar 2009 11:09:35 +0000</pubDate>
		<dc:creator>andre</dc:creator>
				<category><![CDATA[System Administration]]></category>
		<category><![CDATA[Conversion]]></category>
		<category><![CDATA[Drupal]]></category>
		<category><![CDATA[Migration]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.andremiller.net/?p=25</guid>
		<description><![CDATA[I finally decided to go ahead with the conversion from Drupal to Wordpress. I don&#8217; thave anything against Drupal, it just didn&#8217;t work for me.
Luckily for me my site wasn&#8217;t that big so I could do things like categories, tags and slugs manually. All I wanted to copy across were the actual articles and the [...]]]></description>
			<content:encoded><![CDATA[<p>I finally decided to go ahead with the conversion from Drupal to Wordpress. I don&#8217; thave anything against Drupal, it just didn&#8217;t work for me.</p>
<p>Luckily for me my site wasn&#8217;t that big so I could do things like categories, tags and slugs manually. All I wanted to copy across were the actual articles and the comments.</p>
<p>I used parts of the SQL script that <a href="http://spindrop.us/2006/05/19/migrating-from-drupal-47-to-wordpress/">Dave Dash</a>, <a href="http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/">D&#8217;Arcy Norman</a> and <a href="http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/">Mike Smullin</a> worked on and  made a few changes to suit my needs.</p>
<p>To convert the posts had to modify the script a bit because all my nodes in Drupal were of type story, not pages or posts, so I simply removed the where to clause.</p>
<pre># Use the Drupal database
use andremiller_drupal;
# Remove all current posts from Wordpress
TRUNCATE TABLE andremiller_wordpress.wp_posts;
# Insert posts from Drupal into Wordpress
INSERT INTO andremiller_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`,
'post' `post_type`,
IF(n.status = 1, 'publish', 'private') `post_status`
FROM node n
INNER JOIN node_revisions r
USING(vid)
LEFT OUTER JOIN url_alias a
ON a.src = CONCAT('node/', n.nid)
;</pre>
<p>That takes care of the posts. Comments are next.</p>
<p>On my drupal site the email address was not compulsory, so some comments did not have this field filled in. I made a small change here to generate a fake email if none was provided by concatenating the name and hostname of the poster together.</p>
<p>The threading option also didn&#8217;t work for me, but wasn&#8217;t too important, so I just made that a &#8216;0&#8242; to indicate no threading. In Drupal I was not using the approval feature, so the status of all my comments was set to &#8216;0&#8242;. In Wordpress that meant they all came in as unapproved. I updated the SQL so all the comments would be imported as approved.</p>
<pre> TRUNCATE TABLE andremiller_wordpress.wp_comments;
INSERT INTO andremiller_wordpress.wp_comments (comment_post_ID, comment_date, comment_date_gmt, comment_content, comment_parent, comment_author, comment_author_email, comment_author_url, comment_author_ip, comment_approved)
SELECT
nid,
FROM_UNIXTIME(timestamp),
FROM_UNIXTIME(timestamp),
comment,
0,
name,
IF(mail='', CONCAT(REPLACE(LOWER(name),' ', ''), '@', hostname, '.localhost'), mail),
homepage,
hostname,
1
FROM comments;</pre>
<pre lang="MySQL"># update comments count on wp_posts table
UPDATE andremiller_wordpress.wp_posts SET comment_count = (SELECT COUNT(comment_post_id) FROM andremiller_wordpress.wp_comments WHERE andremiller_wordpress.wp_posts.id = andremiller_wordpress.wp_comments.comment_post_id);</pre>
<p>In Drupal my urls of the posts where /content/slug_name, and I wanted to keep those the same so any links from outside would stay the same.</p>
<p>To do this I updated the Wordpress Permalink settings:</p>
<p>Custom Structure : /content/%postname%</p>
<p>And then made sure the slugname of each post matched the url alias of the article in Drupal.</p>
<p>However, this change made the tags and category urls end up to be /content/tag/&lt;tagname&gt; which I didn&#8217;t want. Changing them to the following fixed that up:</p>
<p>Category base: category<br />
Tag base: tag</p>
<p>Now an article can be reached by /content/slug_name, and list of articles with a particle tag by /tag/tag_name.</p>
<p>So far, everything seems to be working just fine.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.andremiller.net%2Fcontent%2Fconverting-from-drupal-55-to-wordpress-271&amp;linkname=Converting%20from%20Drupal%205.5%20to%20Wordpress%202.7.1"><img src="http://www.andremiller.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.andremiller.net/content/converting-from-drupal-55-to-wordpress-271/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

