Site Migration Plugin for WordPress

I’m in the process of finishing up the first version of the plugin that will make site migration really easy for anyone who wants to migrate their sites entirely from one environment to another. This is a great tool for someone setting up their environments initially. Messing around with the database is not a great idea, so this plugin will handle all of the table copying, etc. The requirements are to have a repository in SVN. A future version will have other repository features, such as GIT.

And here’s the first version for your amusement. Modify to your heart’s content, and send me some notes. I know a lot can be fixed and re-factored to make it better.

okm-sitemover

How to Migrate a WordPress Project

When working on WordPress projects, and you need to migrate, let’s say from LOCAL to DEV, or DEV to STAGING, or STAGING to LIVE, whatever the case may be, you need to keep a lot of things in consideration.

Here’s my setup:

  • SVN holds any custom themes or plugins, not the core files, or config files.
  • Multi-tier environment with dropbox backing up local files. (LOCAL, DEV, STAGING, LIVE)
  • LAMP dev environment.

Before you migrate, setup WordPress:

  • Create an entry in the hostfile if necessary
  • Setup the vhosts file
  • Unzip WordPress in the new folder in all environments
    • public_html/newsite.com/dev
    • public_html/newsite.com/stg
    • public_html/newsite.com/www

Let’s go through the basic list:

  • Make sure core is not in SVN. Only keep changes, and new development in SVN.
  • Make a list of plugins used.
  • Extract WordPress in the folder you want to install the website.
  • Copy database to new database.
    • Change DB URL
    • 1
      UPDATE wp_options SET option_value = REPLACE (option_value,'old.domain.com','new.domain.com');
    • Typically from dev.website.com to stg.website.com for staging
    • And dev.website.com to website.com for live.
  • Copy wp-config file to new folder if settings are the same.
    • Change db login credentials.
  • Do a checkout of SVN project in doc root.
  • Re-install all plugins.
    • Configure plugins.

This should be it. I wouldn’t mind working on a custom plugin to handle all this. Maybe add some custom code to do svn updates on the other tier levels as well, so all I would have to do is click a button, and BAM, svn updates to next level.

I might even dedicate a page for this. Standby for this feature.