2024-12-22

Upgrading to Movable Type 4: The Saga

It all began a few weeks ago. I had decided that I wanted to make my website more uniform in its look-and-feel. I was pleased with how my Mainprize Gallery looked. It is powered by Gallery 2 and uses a Carbon theme which has a very clean layout and a dark background that is very good for viewing photos. Even though a dark background isn’t generally ideal for a weblog, I thought that it would be neat to see if I could make a Movable Type blog look like my Carbon gallery.

I started to edit my old Movable Type 3.15 template files and started to get annoyed at propagating the changes to all of my templates. “Perhaps the new Movable Type 4 would be better,” I thought. So merrily of I went and installed MT 4.1 over my old directories…

Yikes! All my templates were broken, and all kinds of incompatibility issues with my plugins. I tried again with a fresh install (not overwriting my existing directories), but still pointing to my existing mysql database. Better. Using the default MT4 templates I got one of my blogs to compile. Then I started to add some of the plugins that I liked (Regex, process_tags, MediaManager, and so on). Almost none of the plugins have been updated to MT4, but at least they seem to still run. Mistakenly I installed Media Manager 2.0 beta 1] which *is* compatible with MT4 and the new concept of “Assets”. What I failed to read was the fact that most of the features had been stripped out. Furthermore, the conversion of my existing MTAmazon data never occurred, although the nice upgrade message spend quite some time supposedly doing just that (no error messages).

I began updating the default templates to look like my gallery pages and made some progress. The Dashboard interface was incredibly clunky and took forever to update the templates. Furthermore, the new <mt:if> and <mt:var> attributes were extremely confusing and very poorly documented. Actually that’s not true, the commands are documented well–the variables defined in the default templates are not. There are pages describing the templates, and the linkages between the modules, but not what the variables actually *do*.

At some point, everything seemed to stop updating… New entries, new templates, nothing would cause a new page to be generated. **ARRGHHH**. Once more I reinstalled MT4, this time pointing to a brand new database, this time with the latest and greatest MT4.2rc2, which promises faster build times, simpler templates and a more intuitive Dashboard. A completely vanilla version of the website was created and everything worked again. Now the hard part.

I wanted to keep the existing entries, comments and so on from the old database, but insert them into the new database.

That proved to be tricky, but I managed it. For those that are interested, I used commands similar to the following:

insert into new_blog.mt_placement select placement_id, placement_blog_id, placement_category_id,placement_entry_id,placement_is_primary from old_blog.mt_placement;

and

insert into new_blog.mt_comment select comment_id,comment_author,comment_blog_id,comment_commenter_id, comment_created_by,comment_created_on,comment_email, comment_entry_id,comment_ip,comment_junk_log,comment_junk_score, comment_junk_status,comment_last_moved_on,comment_modified_by, comment_modified_on,comment_parent_id,comment_text,comment_url, comment_visible from old_blog.mt_comment;

Warning: By the way, DON’T just copy these commands. For these commands to work properly, the columns must be specified in the exact order that they occur in the new database. From time to time, I had to delete the pre-existing rows when conflicts occurred. Provided that you don’t do anything through the Dashboard, the order of inserting the databases probably does not matter.

Once my database seemed to be in good working order, I set about rewriting the templates to make it look like a Carbon theme.

I hacked several plugins including gallery link, and Media Manager, but more on that later.