Tag Archives: WordPress

Moving from Movable Type 3.2 to WordPress 2.3

Julie has decided that she wants to blog a little more frequently. One obstacle to this is that her blog is a spam magnet – or it was until I deleted the Movable Type comment CGIs as a last ditch defense. I’ve had very good results with Akismet on WordPress, so inevitably this meant an upgrade from Movable Type to WordPress. It was only a matter of time before this happened, especially now that I am on WordPress myself. Importing is pretty straight forward. It’s making sure that the permalinks don’t break is the problem. In order to do that you need to make sure that WordPress uses the same numerical id’s that Movable Type used. Which means that you have to hack Movable Type to add an ID field to the exported data, and hack WordPress to use that ID when it creates the new blog entries. Then you do a little mod_rewrite action, and the permalinks should keep on ticking. I’ll now proceed with describing the hacks.

I started with the basic WordPress docs to migrate from Movable Type to WordPress.

Go into the Movable Type 3.2 install and edit lib/MT/ImportExport.pm to add an ID field:

--- ImportExport.pm     2008-02-17 17:55:19.000000000 -0800
+++ ImportExport.pm~    2006-01-04 00:21:09.000000000 -0800
@@ -439,7 +439,6 @@
     my $tmpl = MT::Template->new;
     $tmpl->name('Export Template');
     $tmpl->text(<<'TEXT');
-ID: <$MTEntryID$>
 AUTHOR: <$MTEntryAuthor strip_linefeeds="1"$>
 TITLE: <$MTEntryTitle strip_linefeeds="1"$>
 STATUS: <$MTEntryStatus strip_linefeeds="1"$>

I used Joshua Zader’s modified mt.php and modified it some more so that it would work off of a local file since the MT 3.2 export was over 7MB.

--- /tmp/mt.php 2006-03-27 17:15:00.000000000 -0800
+++ mt.php      2008-02-17 20:51:53.000000000 -0800
@@ -1,7 +1,9 @@
-f<?
+<?
 
 // HERE I'M DEFINING A CUSTOM FUNCTION BASED ON THE ORIGINAL WP_INSERT_POST FUNCTION LOCATED IN IN FUNCTIONS-POST.PHP
 
+set_time_limit(0);
+
 function wp_insert_post_with_id($postarr = array()) {
        global $wpdb, $wp_rewrite, $allowedtags, $user_ID;
 
@@ -287,7 +289,7 @@
 
        function get_entries() {
                set_magic_quotes_runtime(0);
-               $importdata = file($this->file); // Read the file into an array
+               $importdata = file('/usr/share/wordpress/wp-content/mt-export.txt'); // Read the file into an array
                $importdata = implode('', $importdata); // squish it
                $importdata = preg_replace("/(\r\n|\n|\r)/", "\n", $importdata);                
                $importdata = preg_replace("/\n--------\n/", "--MT-ENTRY--\n", $importdata);
@@ -371,7 +373,8 @@
        }
 
        function select_authors() {
-               $file = wp_import_handle_upload();
+/*             $file = wp_import_handle_upload(); */
+                $file['file'] = '/usr/share/wordpress/wp-content/mt-export.txt'; 
                if ( isset($file['error']) ) {
                        echo $file['error'];
                        return;

I hope this will save some poor person the time I wasted piecing all this together. Most of the documentation that I googled up was for earlier versions of either Movable Type or WordPress or both. Really, some right thinking, PHP handy person ought to just go in and fix the Movable Type importer and document how to use the Movable Type template in order to make this all work.

Oh, and if you’re going to run multiple WordPress blogs with different url prefixes on a Debian supplied WordPress, then you are going to need this.

New blog theme winner – Gridlock K2

For now I’ve settled on a new theme for the blog, “Gridlock K2“. I’m running the latest RC(3) of K2 and there were some issues with the Gridlock style, some of which were also reported on the Gridlock K2 page, without resolution. Matthew Eernisse, our resident AJAX and CSS wizard for Chandler Server, was kind enough to take a look at the issues that I was having, most notably the sidebar being pushed to the bottom, and the menu rendering oddly. Matthew reduced hours of work to just a few minutes. In order to prevent anyone else from having to do that, here’s a pointer to the “fixed” gridlock.css for the Gridlock K2 style.

It’s white for now…

Since I switched the blog to WordPress, I’ve been getting a slow but steady stream of complaints about the white on black theme. I’m going to be experimenting with the colors of the theme, but for now, I’ve switched it to black on white. I like that less, but I understand the readability argument that some commenters have made. The black was particularly nice for photo posts, and I’m sorry to be losing that. If there are any Hemingway theme experts out there I’d be happy for some advice.

Comments and suggestions of all kinds welcome.

Size isn’t everything

Stephen O’Grady del.icio.us’ed the inaugural post of the new blog, and his comment was “biggest community wins”. It’s true that the size of a community matters, but it’s not as simple as absolute size. Communities need to reach a point where they become resilient and self sustaining.

That means you need people, and you need enough of them so that there can be an reasonable distribution of work – if one or two people are doing all the work and there are lots of bug/feature requests, then that’s not a reasonable distribution of work. I’ve heard this called ‘scalable’ but it’s not necessarily the case the communities need to scale to accommodate lots and lots of users, but it does need to support its user base well, and the key to that is to share the work.

Another way of measuring the reasonable sharing of work is to look at the “hit by a bus” number – the number of people that would need to be hit by a bus/truck/etc in order to make a substantial impact on the sustainability of the community. If this number is “1” or if there are multiple “1”‘s, then that would be another indicator that the community hasn’t become self-sustaining.

Communities (like marriages, I suppose) that can’t fight well, can’t stay together. So another indicator of a healthy community is the ability to have and resolve conflicts. This is especially important, but often left un-stated as an important quality. It is important for communities to have diversity of opinion and approach, and if they do, conflicts will inevitably follow.

Also related to conflict resolution is the ability of a community do deal with difficult people – Ben and Fitz have a great talk on this [PDF], and it also contains some good content on what makes a healthy community.

So these are just a few of the other factors that influence the quality of a development community.

Happy New Year!

If you are reading the RSS feeds, you may not have noticed that I’ve done a revamp of the blog. Starting with 2007, I’m switching over to the WordPress blogging system. The contents of my old blog can be reached via http://www.sauria.com/pyblog. Existing permalinks to the old content should continue to work. If they don’t that’s a bug and I’d appreciate a comment or an e-mail. Expect there to be falling plaster and such for the next few days while I get things sorted out. I’m going to redirect existing RSS feeds for quite some time, so the move should be invisible to most RSS subscribers as well. The one thing which looks to be a problem is per-category RSS feeds, but the only people really using those are Artima.com, which will just have to be broken for now.

So why the switch? For the past few years, around New Year’s I’ve pondered switching my blog to a blogging package that has a larger community. I originally got involved with PyBlosxom because I was really interested in learning more about blogging specifications, and I wanted a project to force me to play with Python. While it’s been fun to hack on a blogging package, I’ve reached the point where I want to simplify some things in my life in order to open up some time. Also, the comment spam situation has gotten ridiculous, and I wanted some better tools for working against spammers. So for now, what I really want is to move my blog onto a community owned blogging system (as opposed to a commercial or hosted system). That’s not to say that PyBlosxom is not a community owned blogging system, and indeed the community there seems to be broadening out a little bit. But there’s a huge difference between the size of the PyBlosxom community and the size of the WordPress community, and that’s what won me over in the end.