Moving a WordPress blog to a new domain

[12 December 2008]

Having just moved this blog from people.w3.org to cmsmcq.com, I think it might be useful (to others, or to me down the road) to record what I did in order to make the move relatively smooth.

I started out thinking that I would have to export all the data from MySQL on people.w3.org (using my handy backup routine), move the resulting mib.sql file to cmsmcq.com, and load it from the command line.

Reading the various documents about moving blogs from one site to another, or within a site, however, I discovered that that wasn’t what anyone recommended. Export from the old site, I read, and then import into the new site. WordPress has developed a handy export format that can be used conveniently for this purpose.

I tried it. Export worked fine, and I edited the resulting XML document to change all occurrences of “http://people.w3.org/~cmsmcq/blog” to “http://cmsmcq.com/mib”. Then I imported the file to the new WordPress installation. Several articles loaded successfully, but by no means all, and those that did load did not have similar query strings in their URIs. Article http://people.w3.org/~cmsmcq/blog/?p=12 might appear as http://cmsmcq.com/mib/?p=3, not as ...?p=12. That’s a pain, because I’d like to redirect from the old locations to the new, so existing references to the blog don’t break. I know I can build a table containing all the URIs of everything in the blog, and map each to the appropriate URI on the new host, but I’d really rather not have to spend time on that.

I never did figure out why only part of the data was loading successfully; deleting spam from the site, and then re-exporting helped some (more of the posts loaded), but I never got everything to load.

So I reconsidered. I made a new SQL dump of the database on the old site, and edited it to change URIs from the old name to the new. (I also deleted the commands to load data into the user and options tables, since I didn’t want to overwrite them. I deleted the Spam Karma 2 tables, too, since my new host has a newer version of Word Press and the existing SK2, which is no longer maintained, may or may not work with it. I’ll install Bad Behavior instead.)

I tried to load this edited SQL dump to the new host by using the Web interface to MySQL provided by phpMyAdmin; it complained about a problem, and after I fixed that the process kept hanging.

So I split the file into smaller pieces, to evade any timeout and data-volume restrictions, and tried importing each in turn. Either the host choked, or my name service went away about this time; I think some of the smaller SQL files were successfully imported, but not all. Tried again the next day, and it hung again.

So I went back to Plan A: I copied the entire edited SQL file to the new host and loaded it in MySQL from the command line — took about five minutes (including the file transfer), if you don’t count the six or eight hours of time I burned trying to follow other people’s directions.

For the sake of keeping the old URIs stable, I then added a .htaccess file to the ~/cmsmcq/blog directory on people.w3.org to redirect from the old addresses to the new.

Concisely, what worked best for me was:

  1. Export the data from the old server. I did this with the command mysqldump --verbose --add-drop-table --all --extended-insert --quick --skip-lock-tables --user mysql-userid --password dbname > mib.sql, but it might have been better to export individual tables more selectively.
  2. Edit the mib.sql file, changing the old address (in this case “http://people.w3.org/~cmsmcq/blog”) to the new address (in this case “http://cmsmcq.com/mib”) wherever it occurs (it will occur primarily in cross references from one post to another). Some authorities also recommend doing a global search and replace on your old email address. I also took this opportunity to delete tables I didn’t want in the dump: wp_options, wp_usermeta, wp_users, and the tables used by Spam Karma 2 (RIP). And I modified the wp_ prefix in the table names to match the one provided by my hosting service’s auto-install of WordPress.
  3. Copy the edited SQL dump file (in my case named mib.edited.sql) to the new host.
  4. Invoke MySQL from the command line in the obvious way: mysql -h hostname -u username -p dbname < mib.edited.sql
  5. On the original host, add a .htaccess file to the blog directory (here “~cmsmcq/public_html/blog”) including
    RedirectMatch permanent ^/~cmsmcq/blog/(.*)$ http://cmsmcq.com/mib/$1
    Redirect permanent ^/~cmsmcq/blog$ http://cmsmcq.com/mib
    

No WordPress export/import, no phpMyAdmin, just command line tools. I'm all in favor of Web interfaces and so I think that WordPress export and import, and phpMyAdmin, are great ideas; they just didn't work at all well for me in this situation. But one possible take-home message is: it pays to be comfortable with the command line.

Participant observation / moving house

[12 December 2008]

Some ill defined thoughts are occupying my musings.

Some time ago, my colleague Liam Quin decided to include advertising on his site http://www.fromoldbooks.org/, which makes available high-quality scans of public-domain images he finds in … well, in old books. When we have discussed it, he has occasionally observed that one of his goals in doing so is to understand Web technology and Web usage from a slightly different vantage point. I understand him to mean that it is one thing to have a deep factual knowledge about the specifications which undergird and constitute the web, but a different thing to experience them in the process of running a web site. By accepting ads, and experimenting with different advertising programs, and watching his search engine rankings, Liam says, he has learned a good deal.

In a way, it sounds a bit like what one reads about participant observers in introductory anthropology courses. Some kinds of knowledge are more accessible from the inside than from the outside.

A second observation has concerned me for some time. The Semantic Web proposes to use URIs to denote things we want to talk about, and this has the nice side effect that proposals to mint a new term for something are safe from name collisions while still not needing to go through any central registration authority. All of my colleagues at W3C, from Tim Berners-Lee on down, recommend the use of HTTP URIs for such purposes. But new HTTP URIs can be minted, in practice, only by people who own domain names, or who have arrangements with people who own domain names. (It’s a bit like freedom of the press, which guarantees the right of uncensored publication to those who own a press. Fortunately, the Web makes owning a virtual press fairly simple, but it does tend to involve, again, owning a domain name.)

These lines of thought, together with some other considerations that need not concern us here at the moment, have led me to think it’s really high time I moved into the domain-owning classes.

So: We’re moving, or rather, we’ve moved. Messages in a Bottle is now hosted at http://cmsmcq.com/mib instead of the old address on people.w3.org.

I believe all existing references to posts and comments in the old location should be successfully redirected to the same posts and the same comments in the new location; this was a bit harder than it really ought to have been (details in a later post). If any reader finds exceptions or failures, please let me know at the email address whose username is “mib” and whose host name is “cmsmcq.com”.

Six-month retrospective and evaluation

[16 July 2008]

This klog started about six months ago, as an experiment. In an early post, I wrote:

So I’m going to start a six-month experiment in keeping a work log. Think of it, dear reader, as my lab notebook. (I was going to do it starting a year ago, but, well, I didn?~~t. So I?~~m going to start now.)

My original plan was to make it accessible only to the W3C Team, so that I could talk about things that probably shouldn?~~t be discussed in public or in member space. Norm Walsh has blown a hole in that idea by pointing to this log [Hi, Norm!]. So public it is. (Ideally, I?~~d have a blog in which each item could be marked with an ACL, like resources in W3C date space: Team-only, Member-only, World-readable. Maybe later.)

Next year about June, if I remember, I will evaluate the experiment and decide whether it?~~s been useful for me or not.

So, as one of my teachers used to say at the beginning of a group evaluation of some student work: what works, what doesn’t work?

Things that don’t work as well as I would like:

  • As might have been predicted, the fact that Messages in a Bottle is public, not private, has encouraged me to be circumspect in ways that fight with the lab-notebook goal. I don’t want to be carelessly rude about colleagues or others in public, the way one can be in private conversations and to their faces. Across a dinner table, one can greet a claim made by a colleague with a straightforward cry of “But that’s bullcrap!” without impeding a useful discussion. (This depends in part on the conversational style cultivated by individuals and groups, of course. But as some readers of this post will know, this is not a speculation but a report.) It doesn’t feel quite right, however, to say in public of something proposed by someone acting in good faith that it’s just bullcrap. You have to spend some time thinking of another way to put it. Enrique comes in handy here, since he will say anything. It has not been proven, however, that Enrique will never piss anyone off.
  • For the same reason, I have not yet found a good way of recording issues and concerns I don’t have good answers for. In a lab notebook, or a private conversation, one can talk more forthrightly about things that are going wrong, or things that have gone wrong, and how to right them. But in public, members of a Working Group, and editors of a specification, do better to accept a sort of cabinet responsibility for the work product. You do the best you can to lead the group to what you believe is the right decision, and then you accept the decision and defend it in public. I have not yet found a way to combine the acceptance of that joint responsibility, and the concomitant need to avoid bad-mouthing decisions one is responsible for defending, on the one hand, with forthright analysis of errors on the other. Sometimes careful phrasing can do the job, but any need for care in phrasing constitutes a tax on the writing of posts about tricky subject matter.
  • So try as I might to keep pushing these posts toward being a work log, the genre keeps pushing back and trying to make them into something like a first-person newspaper column. That’s a fine and worthy thing, and I can’t say I don’t enjoy that genre, but it’s not quite what I was aiming for when I started. As a result, one cannot read back through the archives and get the kind of record one wants in a lab notebook, and I’m not sure Messages in a Bottle is working optimally as a means for me to communicate with myself, or with those I work with most closely.

And on the other side, some things do seem to work.

  • At one level of abstraction, the primary goal of this worklog is to improve communication between me and those I work with. There is some evidence, both in the comments here and in other channels, that some of those I work with do read these postings and find them useful, or at least diverting. I have never bothered to try to check the server logs for hit or visitor counts — my guess, based on my Spam Karma 2 reports, is that humans are strongly outnumbered by spambots among my readers, and I’d just as soon not have that demonstrated in quantitative detail — but it’s clear that more people read these posts at least sporadically than I would ever dream of pestering by sending them email meditations on these topics. If they read these posts and derive any insight from the reading, then this klog would appear to have improved communication at least somewhat.
  • It’s probably not actually a bad thing that I think of this as a public space. It makes me a bit more likely to try to write coherently, to supply relevant context, and to do the other things that help ensure that a communication can be read with understanding by readers distant in time, space, sentiment, or context from the author. If I occasionally indulge in a private joke or two, I hope you will bear with me.
  • It’s easier for me to find records of points of view and analyses that have gone into posts here than to find records kept only in files on my hard disk or on paper shoved into the shelves behind me.
  • So far, no one has complained even about the really boring technical discussions about regular grammars, even though it’s clear some of my readers would rather be reading about Enrique.

In sum, I think I believe the experiment can be adjudged modestly successful, and I will continue it for another six months.

A nicer editing environment

Since starting this worklog, I’ve been experimenting using the screen that WordPress provides for writing blog posts.

It’s good to see every now and then how the other half lives.

And I’m impressed: the blog editing screen WordPress gives you is significantly better than a poke in the eye with a sharp stick, which distinguishes it from some other systems I have experienced.

But, well, not so nice that anyone could plausibly expect me to use it instead of Emacs. So today I decided it was time to get a bit more realistic about how to draft posts, particularly those that are tricky and that I want to get right. That means, I need a way to edit in Xemacs, using psgml.el’s XML mode, and conveniently upload to WordPress.

The editing-in-Xemacs part is easy. All I have to do is stop not doing it. What was needed was a stylesheet to translate from the version of TEI Lite I habitually use for writing, into the odd mix of normal XHTML and blank lines for paragraph breaks that WordPress uses. (I should probably experiment with using normal p elements — will WordPress let me use them?)

Answer: yes. So I don’t have to render paragraphs using just blank lines. And I didn’t really need to do a new stylesheet; I could just have used my existing TEI-to-HTML translation. I’ll comfort myself with the thought that the new stylesheet is smaller and has less cruft.

It’s still a little awkward that I have to cut and paste from my Emacs buffer into the WordPress write-post screen; I notice that David Carlisle seems to be able to edit existing posts from within emacs, using T. V. Raman’s g-client package. This makes me jealous, but not jealous enough to drop everything to work on an emacs mode for posts to WordPress. (Everything I haven’t already dropped in order to play with my tei-to-wordpress stylesheet and to write this post, that is.)

When the cut-and-paste gets annoying enough, I’ll take the time to make the stylesheet generate the post in Web-forms submission format, and write a script to upload to the server. But for now, being back in emacs for editing is enough.

Spam Karma 2 installed

Installed Spam Karma 2, today, and hope it deals well with comments from real readers (who are welcome here) and from spambots and spammers (who are not).

There are a few points that have caused a little concern.

When I ran the filters on the accumulated comments and spam, it took half of the spam comments and approved them as OK.

I’m going to give it the benefit of the doubt for now, assuming that it’s using some sort of Bayesian filtering that needs training. If this is still happening a month from now, it will be harder to be patient.

You can of course review approved comments and say “No! bad choice! that one is spam.” And similarly you can review the spam bucket and say that something is not actually spam.

It was at this point that I almost turned it off again, after ten minutes of use. It’s set up to display the lists of recently harvested spam and approved comments in a concise tabular form, with the admirable goal of getting more data onto the screen, and to expand any cell in the table if you hover over it, so as to show the full entry.

Perhaps my browser is set up to call the hover() method more quickly that the developer expects, but I found it impossible to move my mouse across the table (e.g. to reach the scroll bar, or to reach a cell I wanted to hover over) without one cell after the other exploding, shifting text around on my screen, and then collapsing again. It reminded me of nothing so much as flying as a child in a Cessna or Piper Cub and hitting air pockets that caused the plane to fall precipitously, climb again, and then drop again. I can almost smell that unforgettable stench of high-test fuel in an small enclosed space.

The only way I could reach something I wanted to hover over and look at was to sneak up on it by moving my mouse cautiously down the left or right margin and then into the table. And even then, it only expands one cell at a time, so you don’t get a good overview of any individual comment and its content and karma rating.

Fortunately, you can turn the hover behavior off. You have to turn on ‘Advanced’ options and uncheck the box that says “if using … css-impaired browsers, you should disable this feature”. It doesn’t mention susceptibility to motion-sickness.

The table of recently harvested spam is labeled as including comments with karma lower than -20; the threshold can be changed, and I’m glad to have a clear statement of what’s displayed and what’s not. But I found it confusing to have comments with karma of -6 and whatnot included. Eventually I concluded that the screen meant “higher” than -20.

The beauty of open source is that I was able to correct that typo without any significant effort.

The display of information about recently harvested spam with bad karma is as close to illegible as a mere color scheme can make it. (Well, that’s too harsh; I’ve seen worse, but not in a color scheme intended for actual use.) Dark green and medium-dark red against dark gray.

The beauty of open source is, again, I can change it. I’ve got CSS and I’m not afraid to use it.

And finally, the author has announced that he doesn’t expect to update it, because he’s tired of incompatible changes to WordPress that break plugins.

I can see his point. But any problem caused by his decision is down the road a while; perhaps others will pick up the code, or perhaps I’ll shift to a different tool later, just for educational purposes (the way I change Emacs color themes every few months or so, to see how they wear over time).

On the other hand, despite the concerns, Spam Karma appears quite popular and successful, and to have attracted fewer vehement denunciations than some other anti-spam tools. So the official attitude here is the traditional guarded optimism.

We will learn, as time goes by, whether that optimism is justified.