I am proposing a solution for transferring a WordPress blog from one host to another.

At the moment a lot of developers use a staging server (e.g. blog.localhost) and then migrate their changes onto a “live” site. The current problem is that WordPress is very hard to migrate to a new host (e.g. blog.brianmckenna.org to briansblog.com).

Even for expert users, the WordPress database contains a lot of serialised PHP and that data includes the old host. When the data is imported into a new host, a lot of the links are out of date and can make parts of the site unusable. It’s also impossible (in most cases) to just find and replace the old host with the new host because serialised PHP includes the length of the string.

This solution would create a simple and effective user interface for migrating a WordPress installation to a new host. The user would input the new credentials (FTP and new database) and the solution would migrate everything automatically. The aim is to make it as painless as possible. I’ve included a small interface mockup to the right (which of course could be improved).

Under the hood, the solution would use XML-RPC to transfer WordPress data and copy each of the files over through FTP (including media, modified core files, themes and plugins).

There are many possible failure points:

  • FTP/database permission problems
  • FTP/database connectivity issues
  • Time/memory/disk intensity
  • Files/tables already exist and have other data in them

The solution should try to be as fail-proof as realistically possible. It should be able to decipher errors and give possible causes/solutions to the user.

At first, I would like to create the solution as a plugin. Towards the end (see the next section, Schedule) I would like to work on getting it to sufficient quality for inclusion into WordPress core.

There have been some other attempts at this problem. One example is the Serialization-fixer. These projects can work but aren’t very friendly to use and doesn’t support migrating files as well as the database.

Schedule

My University semester finishes around May 28th. My next semester starts around July 19th. That gives me over 7 weeks without assignments to work on the project (though, I’ll probably be working part-time).

May 24th

Start coding!

June 7th

Transferring WordPress data using XML-RPC should be started. Most important data to transfer would include posts and pages. At this stage, two different installs of WordPress with the plugin would be necessary.

June 21st

Transferring should be mostly finished – I should be able to enter in the MySQL credentials and core WordPress data should be synchronised using XML-RPC.

The exporting should be tested against as many different versions of Apache and PHP as I reasonably can.

June 28th

FTP migration should be started. JavaScript should initiate the migration asynchronously and report the status back to the user (via short polls or possibly Comet).

PemFTP is already included in WordPress core so there should be no additional dependencies.

Only a single WordPress installation would be necessary after this stage.

July 12th

FTP migration should be getting almost feature complete. The project should be tested against many different FTP environments and configurations.

Most reasonably possible problems should be identified.

This is the mid-way mark.

July 26th

Stability should be the focus for the past two weeks. I should try and recruit as many people as possible from the community to help test the migration feature.

Functional unit tests should be developed for things that:

  • Don’t directly communicate with FTP servers
  • Don’t directly communicate with databases
  • Don’t directly access the filesystem

August 2nd

The user-interface should be refined by this stage. Informative error messages should be presented to the user with possible fixes or work-arounds.

I will try to get in contact with the WordPress UX/UI team so they can help me along in this area.

August 9th

Small features suggested by WordPress core should be implemented by this stage. The plugin should have been refactored via the help of WordPress core contributors. The plugin should follow all of the conventions and best practices of WordPress to allow consideration for inclusion into WordPress core.

August 16th

Only bug fixes and additional cleanup should be conducted up to this milestone. Project is now finished!