Sunday, February 13, 2011

How I went about moving and updating my ‘trapped’ Wordpress site

As the volunteer web-editor for a local non-profit, I decided to replace our old-style SHTML site with a new Wordpress CMS-based site. I didn't want to replace the current/live site, however, until I had a complete replacement (and the approval of the management). So I created the new Wordpress site as a temporary sub-site of our existing site. Unfortunately, because of the provider,’s, stupid install script the new site was ‘trapped’ – I could neither update the Wordpress software nor could I reconfigure any plugins. The primary reason for this was that had set it up as a (partly) shared install, i.e., some of the system files were in a shared read-only folder somewhere (not in my personal folders).

In order to remedy this I had to do the following:
  • make a backup of the new Wordpress sub-site
  • create a new properly-working copy in the new location
  • merge the two copies into a proper replacement site
  • confirm that I could update and configure everything properly
There were lots of instructions online about how to go about moving a Wordpress site but none seemed to apply to my situation -- un-trapping a script-created site!


I initially tried installing an up-to-date copy of Wordpress as a new install, and confirmed that it worked properly by installing all the same plugins and theme as before. I also restored the ‘wp-content’ files from my original site. I then used the Tools > Import function to restore the “WXR” (.XML) file I’d exported from the original site. Unfortunately, this only restored the Pages but none of the theme or widget settings. As a last attempt I dumped the new site's MySQL database and restored it from a tweaked copy of the original DB (where I’d done a search-and-replace for all the URLs). For whatever reason this caused the whole setup to reset to defaults. Fail.

  1. Deleted all the files in the new location and started over.
  2. Copied all the install files from a matched version of WordPress (v3.0.1 downloaded from their Release Archive).
  3. Manually updated only the wp-config.php.
  4. Copied all the files from the old site. I had to rename the script-created folder, 'wordpress-content', to match the standard folder-name, 'wp-content'
  5. Used the phpMyAdmin technique to download the SQL DB from the initial site in uncompressed text format.
  6. Manually fixed all the URL and folder references using search-and-replace: >> >>
    wp/wordpress-content >> wp-content
    wordpress-content >> wp-content
  7. Went into phpMyAdmin on the new site, dumped all the tables and restored the edited SQL file.
  8. Finally, I tested the Wordpress auto-update as well as installing/configuring new plugins, and it all works properly!

No comments: