Skip to content

Instantly share code, notes, and snippets.

@allejo
Created April 10, 2013 19:19
Show Gist options
  • Save allejo/5357611 to your computer and use it in GitHub Desktop.
Save allejo/5357611 to your computer and use it in GitHub Desktop.
Google Summer of Code 2013 - WordPress Migration Assistant

The goal for WordPress’ Migration Assistant will be to aid in migrating any WordPress blog to a new host or simply changing the domain name of a WordPress blog.

The solution to this problem will be to create a user interface to be part of the administrative control panel where the blog admin will be able to migrate the WordPress blog or simply edit the blog URL, which will go through the current database and change the respective fields to contain the new URL. The blog admin will have two options for migration.

  1. The first option will be to provide FTP and MySQL credentials for the new host and the migration assistant will connect to the new host and start transferring Wordpress files, uploads, plug-ins, themes, and the database; provided the connection was successful.

  2. The second option will be to download a zip file containing the exported database and all of the Wordpress files so you can upload to the new web host and extract all the files there. (The option will also be used as a fallback in case the FTP or MySQL credentials would fail in the first option.)

Both these options will contain a generated 'migrationassistant.php' which will need to be executed on the new webhost. In the process of migration, the migration assistant will generate a new 'wp-config.php' file with the new MySQL credentials (as entered by the blog admin on the original WordPress install). This file will be named 'wp-config.php.new' and when the 'migrationassistant.php' file is run, this file will be renamed and the connection to the new database will be estasblished. At this point, the Migration Assistant will now prompt for any last minute changes, such as a new URL or different MySQL credentials if the connection were to fail. Now the database with any changes (new url) will be imported and the blog admin will be able to see the progress of the import and any errors that may occur. Once the procedure is done, the blog admin will be prompted to confirm the deletion of the exported files and itself to avoid any issues that may arise if the files were to be downloaded or executed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment