<?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>scurker.com &#187; web development</title>
	<atom:link href="http://scurker.com/categories/web-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://scurker.com</link>
	<description>Blog &#38; Portfolio of Jason Wilson</description>
	<lastBuildDate>Fri, 04 Jun 2010 05:12:33 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Particle Generator using HTML5&#8217;s Canvas</title>
		<link>http://scurker.com/blog/2010/06/particle-generator-using-html5s-canvas/</link>
		<comments>http://scurker.com/blog/2010/06/particle-generator-using-html5s-canvas/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 05:10:51 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://scurker.com/?p=251</guid>
		<description><![CDATA[Particle effects are pretty awesome. Particles by themselves are fairly simple, but by generating multitudes of particles with set variables you can create a range of effects such as fire, smoke, or water. A particle generator or emitter allows you to adjust the variables giving you control over the types of effects you can generate.
I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Particle effects are pretty awesome. Particles by themselves are fairly simple, but by generating multitudes of particles with set variables you can create a range of effects such as fire, smoke, or water. A particle generator or emitter allows you to adjust the variables giving you control over the types of effects you can generate.</p>
<p><a href="/projects/particles"><img class="alignleft" src="/images/particles.png" alt="Particle Generator" title="Particle Generator"/></a>I&#8217;ve been working on another project that needed a particle generator, thus this demonstration was born.</p>
<p>There are several presets I&#8217;ve included, but you can easily generate new types of effects by playing around with the available variables on the presets.</p>
<p>The demo does not give you access to everything so in order to create more fine tuned options, here&#8217;s all the currently available variables:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
  shape<span style="color: #339933;">:</span> <span style="color: #3366CC;">'circle'</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// square or circle</span>
  velocity<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Vector<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>y<span style="color: #339933;">:</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>  <span style="color: #006600; font-style: italic;">// movement vector; only y is used</span>
  xVariance<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// +/- start x position (random)</span>
  yVariance<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// +/- start y position (random)</span>
  spawnSpeed<span style="color: #339933;">:</span> <span style="color: #CC0000;">25</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// # particles spawned per cycle</span>
  generations<span style="color: #339933;">:</span> <span style="color: #CC0000;">100000</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// # of cycles to run for</span>
  maxParticles<span style="color: #339933;">:</span> <span style="color: #CC0000;">500</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// max # of particles allowed on screen</span>
  size<span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// size of particles</span>
  sizeVariance<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// +/- size of particles (random)</span>
  life<span style="color: #339933;">:</span> <span style="color: #CC0000;">30</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// # of cycles a particle can live</span>
  lifeVariance<span style="color: #339933;">:</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">,</span>    		  <span style="color: #006600; font-style: italic;">// +/- lifetime of particle (random)</span>
  direction<span style="color: #339933;">:</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// initial start direction</span>
  directionVariance<span style="color: #339933;">:</span> <span style="color: #CC0000;">15</span><span style="color: #339933;">,</span>          <span style="color: #006600; font-style: italic;">// +/- direction (random)</span>
  color<span style="color: #339933;">:</span> <span style="color: #3366CC;">'#fff'</span><span style="color: #339933;">,</span>		  <span style="color: #006600; font-style: italic;">// can be hex code or rgb</span>
  opacity<span style="color: #339933;">:</span> <span style="color: #CC0000;">1</span><span style="color: #339933;">,</span>			  <span style="color: #006600; font-style: italic;">// particle opacity</span>
  onDraw<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>p<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #006600; font-style: italic;">// onDraw passes in the current particle and is called before each</span>
    <span style="color: #006600; font-style: italic;">// particle is displayed on the screen. This function is used in </span>
    <span style="color: #006600; font-style: italic;">// several of the presets to adjust the color or opacity given</span>
    <span style="color: #006600; font-style: italic;">// the particle's current age and lifespan.</span>
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>If you are using Firefox and Firebug, you can create your own objects and update the particle generator by using <code>particles.update(myObject);</code> via the command line.</p>
<p>As usual, HTML5 and Canvas is not currently supported by IE7/IE8, so you&#8217;ll need to use another browser in order for this to work. The demo has been tested in Firefox, Safari and Chrome, but I highly recommend using Chrome for the demo as it seems to run the most efficient.</p>
<p><a href="/projects/particles">On to the demo!</a> Or alternatively, view the source <a href="/projects/particles/js/particle.js">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://scurker.com/blog/2010/06/particle-generator-using-html5s-canvas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Migration from Drupal 6.x to Wordpress 2.9x</title>
		<link>http://scurker.com/blog/2010/02/migration-from-drupal-6-x-to-wordpress-2-9x/</link>
		<comments>http://scurker.com/blog/2010/02/migration-from-drupal-6-x-to-wordpress-2-9x/#comments</comments>
		<pubDate>Fri, 26 Feb 2010 17:22:58 +0000</pubDate>
		<dc:creator>Jason</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[drupal]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://scurker.com/?p=50</guid>
		<description><![CDATA[I recently found myself wanting to move my personal blog (blog.scurker.com) from Drupal 6.x to Wordpress for various reasons. I primarily followed this tutorial, but wanted to outline some additional information in the transfer.
Database Conversion Table



Drupal 6.x Table(s)
Wordpress 2.9x Equivalent




term_data, term_hierarchy
wp_terms


node, node_revisions
wp_posts


term_node
wp_term_relationships


comments
wp_comments



Truncate Wordpress Tables
First, I needed to remove any data that is currently in certain [...]]]></description>
			<content:encoded><![CDATA[<p>I recently found myself wanting to move my personal blog (<a href="http://blog.scurker.com">blog.scurker.com</a>) from <a href="http://drupal.org">Drupal 6.x</a> to <a href="http://wordpress.org">Wordpress</a> for various reasons. I primarily followed <a href="http://socialcmsbuzz.com/convert-import-a-drupal-6-based-website-to-wordpress-v27-20052009/">this tutorial</a>, but wanted to outline some additional information in the transfer.</p>
<h2>Database Conversion Table</h2>
<table class="data-table">
<thead>
<tr>
<th>Drupal 6.x Table(s)</th>
<th>Wordpress 2.9x Equivalent</th>
</tr>
</thead>
<tbody>
<tr>
<td>term_data, term_hierarchy</td>
<td>wp_terms</td>
</tr>
<tr>
<td>node, node_revisions</td>
<td>wp_posts</td>
</tr>
<tr>
<td>term_node</td>
<td>wp_term_relationships</td>
</tr>
<tr>
<td>comments</td>
<td>wp_comments</td>
</tr>
</tbody>
</table>
<h2>Truncate Wordpress Tables</h2>
<p>First, I needed to remove any data that is currently in certain wordpress tables so I could work with a fresh slate.</p>
<p><strong>Note:</strong> By default when you install wordpress all tables are prefixed with <code>wp_</code> unless you changed it to something else. The below queries will need to be modified if you used anything else other than <code>wp_</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_comments;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_postmeta;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_posts;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_term_relationships;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_term_taxonomy;
<span style="color: #993333; font-weight: bold;">TRUNCATE</span> <span style="color: #993333; font-weight: bold;">TABLE</span> wp_terms;</pre></div></div>

<h2>Import Taxonomy Terms</h2>
<p>The next sets of queries imports taxonomy terms.</p>
<p><strong>Note:</strong> Table names pre-pended with <code>drupal.</code> needs to be the actual name of your drupal database. You will need to change this to whatever you have your drupal database named.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_terms <span style="color: #66cc66;">&#40;</span>term_id<span style="color: #66cc66;">,</span> name<span style="color: #66cc66;">,</span> slug<span style="color: #66cc66;">,</span> term_group<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SELECT</span> d<span style="color: #66cc66;">.</span>tid<span style="color: #66cc66;">,</span> d<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">REPLACE</span><span style="color: #66cc66;">&#40;</span>LOWER<span style="color: #66cc66;">&#40;</span>d<span style="color: #66cc66;">.</span>name<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">' '</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'-'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">0</span>
  <span style="color: #993333; font-weight: bold;">FROM</span> drupal<span style="color: #66cc66;">.</span>term_data d
  <span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> drupal<span style="color: #66cc66;">.</span>term_hierarchy h
  <span style="color: #993333; font-weight: bold;">USING</span><span style="color: #66cc66;">&#40;</span>tid<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<p>By default, Wordpress has several taxonomy types available; <code>categories</code>, <code>post_tag</code>, and <code>link_category</code>. In my Drupal instance I used taxonomy primarily as tags, but you may have a different need. You may need to modify the 3rd line in the below query depending on how you want taxonomies imported:</p>
<ul>
<li><strong>Categories</strong>: <code>category</code></li>
<li><strong>Link Categories</strong>: <code>link_category</code></li>
<li><strong>Post Tags</strong>: <code>post_tag</code></li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_term_taxonomy <span style="color: #66cc66;">&#40;</span>term_taxonomy_id<span style="color: #66cc66;">,</span> term_id<span style="color: #66cc66;">,</span> taxonomy<span style="color: #66cc66;">,</span> 
                              description<span style="color: #66cc66;">,</span> parent<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SELECT</span> d<span style="color: #66cc66;">.</span>tid<span style="color: #66cc66;">,</span> d<span style="color: #66cc66;">.</span>tid<span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'post_tag'</span><span style="color: #66cc66;">,</span> d<span style="color: #66cc66;">.</span>description<span style="color: #66cc66;">,</span> h<span style="color: #66cc66;">.</span>parent
  <span style="color: #993333; font-weight: bold;">FROM</span> drupal<span style="color: #66cc66;">.</span>term_data d
  <span style="color: #993333; font-weight: bold;">INNER</span> <span style="color: #993333; font-weight: bold;">JOIN</span> drupal<span style="color: #66cc66;">.</span>term_hierarchy h
  <span style="color: #993333; font-weight: bold;">USING</span><span style="color: #66cc66;">&#40;</span>tid<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h2>Import Post Content</h2>
<p>Drupal allows for custom post types, while as of Wordpress 2.9x, custom post types are only available via plugins. You can use the below query unmodified and it will convert all stories to posts, and everything else will transfer over as is. If you need to convert additional post types, you can add additional case statements.</p>
<p>Example:<br />
<code>WHEN 'book' THEN 'post'</code></p>
<p>I also adjusted the query so that &#8216;post_date_gmt&#8217; would be populated correctly based on my GMT offset of -6:00 (Central Time). If you are in a different timezone you will need to adjust <code>FROM_UNIXTIME(created+21600)</code> to subtract or add correctly based on your location.</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span>
    wp_posts <span style="color: #66cc66;">&#40;</span>id<span style="color: #66cc66;">,</span> post_date<span style="color: #66cc66;">,</span> post_date_gmt<span style="color: #66cc66;">,</span> post_content<span style="color: #66cc66;">,</span> post_title<span style="color: #66cc66;">,</span>
    post_excerpt<span style="color: #66cc66;">,</span> post_name<span style="color: #66cc66;">,</span> post_type<span style="color: #66cc66;">,</span> post_modified<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> <span style="color: #993333; font-weight: bold;">DISTINCT</span>
    n<span style="color: #66cc66;">.</span>nid<span style="color: #66cc66;">,</span> FROM_UNIXTIME<span style="color: #66cc66;">&#40;</span>created<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> 
    FROM_UNIXTIME<span style="color: #66cc66;">&#40;</span>created<span style="color: #66cc66;">+</span><span style="color: #cc66cc;">21600</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> body<span style="color: #66cc66;">,</span> n<span style="color: #66cc66;">.</span>title<span style="color: #66cc66;">,</span> teaser<span style="color: #66cc66;">,</span> LOWER<span style="color: #66cc66;">&#40;</span>n<span style="color: #66cc66;">.</span>title<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span>
    <span style="color: #66cc66;">&#40;</span>CASE n<span style="color: #66cc66;">.</span>type
      WHEN <span style="color: #ff0000;">'story'</span> THEN <span style="color: #ff0000;">'post'</span>
      ELSE n<span style="color: #66cc66;">.</span>type
    END<span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">AS</span> type<span style="color: #66cc66;">,</span>
    FROM_UNIXTIME<span style="color: #66cc66;">&#40;</span>changed<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span> drupal<span style="color: #66cc66;">.</span>node n<span style="color: #66cc66;">,</span> drupal<span style="color: #66cc66;">.</span>node_revisions r
<span style="color: #993333; font-weight: bold;">WHERE</span> n<span style="color: #66cc66;">.</span>vid <span style="color: #66cc66;">=</span> r<span style="color: #66cc66;">.</span>vid;</pre></div></div>

<h2>Import Post and Taxonomy Relationships</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_term_relationships <span style="color: #66cc66;">&#40;</span>object_id<span style="color: #66cc66;">,</span> term_taxonomy_id<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">SELECT</span> nid<span style="color: #66cc66;">,</span> tid <span style="color: #993333; font-weight: bold;">FROM</span> drupal<span style="color: #66cc66;">.</span>term_node;</pre></div></div>

<h2>Category Count Updating</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> wp_term_taxonomy tt
  <span style="color: #993333; font-weight: bold;">SET</span> count <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span>
    <span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color: #66cc66;">&#40;</span>tr<span style="color: #66cc66;">.</span>object_id<span style="color: #66cc66;">&#41;</span>
    <span style="color: #993333; font-weight: bold;">FROM</span> wp_term_relationships tr
    <span style="color: #993333; font-weight: bold;">WHERE</span> tr<span style="color: #66cc66;">.</span>term_taxonomy_id <span style="color: #66cc66;">=</span> tt<span style="color: #66cc66;">.</span>term_taxonomy_id
  <span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h2>Import Comments</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> wp_comments <span style="color: #66cc66;">&#40;</span>comment_post_ID<span style="color: #66cc66;">,</span> comment_date<span style="color: #66cc66;">,</span> 
            comment_content<span style="color: #66cc66;">,</span> comment_parent<span style="color: #66cc66;">,</span> comment_author<span style="color: #66cc66;">,</span> 
            comment_author_email<span style="color: #66cc66;">,</span> comment_author_url<span style="color: #66cc66;">,</span> comment_approved<span style="color: #66cc66;">&#41;</span>
  <span style="color: #993333; font-weight: bold;">SELECT</span> nid<span style="color: #66cc66;">,</span> FROM_UNIXTIME<span style="color: #66cc66;">&#40;</span>timestamp<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">,</span> comment<span style="color: #66cc66;">,</span> thread<span style="color: #66cc66;">,</span> 
              name<span style="color: #66cc66;">,</span> mail<span style="color: #66cc66;">,</span> homepage<span style="color: #66cc66;">,</span> <span style="color: #993333; font-weight: bold;">STATUS</span> 
  <span style="color: #993333; font-weight: bold;">FROM</span> drupal<span style="color: #66cc66;">.</span>comments;</pre></div></div>

<h2>Update Comment Count</h2>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">UPDATE</span> wp_posts 
  <span style="color: #993333; font-weight: bold;">SET</span> comment_count <span style="color: #66cc66;">=</span> <span style="color: #66cc66;">&#40;</span><span style="color: #993333; font-weight: bold;">SELECT</span> COUNT<span style="color: #66cc66;">&#40;</span>comment_post_id<span style="color: #66cc66;">&#41;</span> 
  <span style="color: #993333; font-weight: bold;">FROM</span> wp_comments 
  <span style="color: #993333; font-weight: bold;">WHERE</span> wp_posts<span style="color: #66cc66;">.</span>id <span style="color: #66cc66;">=</span> wp_comments<span style="color: #66cc66;">.</span>comment_post_id<span style="color: #66cc66;">&#41;</span>;</pre></div></div>

<h2>Update Post Slugs</h2>
<p>Drupal&#8217;s URL aliases is equivalent to Wordpress&#8217; permalinks. Drupal has a much more aggressive title sanitation than Wordpress. I wanted the ability to keep my titles the same for SEO reasons when migrating over to Wordpress.</p>
<p>In order to keep my old titles, I need to hook into Wordpress&#8217; <a href="http://codex.wordpress.org/Function_Reference/sanitize_title">title sanitation</a> with similar rules to Drupal. The below code will need to be placed somewhere in the <code>functions.php</code> file of your current theme.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sanitize_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_sanitize_title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> my_sanitize_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\b(a|an|as|at|before|but|by|for|from|is|in|into|like|of|off|on|onto|per|since|than|the|this|that|to|up|via|with)\b/i'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/-+/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$title</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You will need to save the below code to a file i.e. &#8220;fix-slugs.php&#8221; in your main Wordpress directory and run it through your browser.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
&nbsp;
  <span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-load.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$posts</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">&quot;SELECT ID, post_title, post_name FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span>&quot;</span>
  <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$ignored</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$errors</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strcmp</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$slug</span> <span style="color: #339933;">=</span> sanitize_title<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_name</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">show_errors</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;UPDATE <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> SET post_name='<span style="color: #006699; font-weight: bold;">$slug</span>' WHERE ID=<span style="color: #006699; font-weight: bold;">$post-&gt;ID</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$errors</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span> <span style="color: #339933;">===</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$ignore</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$count</span><span style="color: #339933;">++;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
       <span style="color: #000088;">$ignored</span><span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;strong&gt;<span style="color: #006699; font-weight: bold;">$count</span> post slug(s) sanitized.&lt;/strong&gt;&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$ignored</span> post(s) ignored.&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$errors</span> error(s).&lt;br /&gt;&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you were following along with <a href="http://socialcmsbuzz.com/convert-import-a-drupal-6-based-website-to-wordpress-v27-20052009/">this tutorial</a>, I&#8217;ve made a few changes based on my Drupal setup using <a href="http://codex.wordpress.org/Database_Description">Wordpress database description</a> as a reference when I ran into issues. There may be some additional steps to be completed if you uploaded images through Drupal&#8217;s interface, but the above queries were able to successfully migrate my data from Drupal to Wordpress.</p>
]]></content:encoded>
			<wfw:commentRss>http://scurker.com/blog/2010/02/migration-from-drupal-6-x-to-wordpress-2-9x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
