WordPress is one of the best Content Management System(CMS) that make our work easy to build a web site. I really interested in involving WordPress CMS and i found that WordPress announced some ideas(GSoC 2010 ideas) that they want to build on their system in future. I have gone through the ideas and found a cool idea MovingWordpress . So i this post i’ll talk about this idea and my solution to handle this problem.
The problem goes like this . . .
Currently, if you want to move your WordPress install to a new host and keep the same domain, you only need to move all the files (WordPress Core, Themes, and Plugins), and then export/import the database. It’s pretty straight forward, but still more complex than many users are capable of.
However, if you want to change the domain (even without moving to a new host) you have to export the database, do some search and replace on the .sql file, and then re-import the updated database. Even then, if the new domain has a different number of characters in it than the old one did, you can run against problems if any of the places you replaced the name happened to be inside a serialized array (almost all the options, including things like widget settings, text widget text, etc).
The goal of this project would be to make a these kinds of transitions simple and smooth. If only the domain is changing, then when the user updates the WordPress URL we would update internal links in their posts, settings, image urls, etc. If they are moving to a new host, allowing them to install WordPress at their new host and enter their credentials for their old host (WordPress admin credentials as well as FTP credentials) and WordPress would simply import everything (posts, settings, uploads, theme, plugins, etc).
My solution goes like this . . .
Change the domain name
This part is risky and need to handle it carefully. If we had some problem with WordPress address URL then it’s hard to access admin panel and page lost its beauty. The problem with Blog address URL will break the link with blogs and comments.
Through my plug-in it will be able to access the wp_option table in WordPress database and make the modification on appropriate fields. But here we have some problem with handling sterilized array so I planned to unsterilized the valued then make the changes in that value and update the values to wp_option table.
Change the server location without changing domain address
The current process to move the WordPress is, download the whole files and export the database from old server and upload it to new server so it consumes some time and not an effective way and there is a chance to failure.
So the new method will be effective and able to reduce the errors while moving the files. Another interesting thing I would like to add here is, blogger no need to wait until the uploading process finishes. It means the process will run in the back and blogger will get a notification after all the files moved to the new server like importing posts to WordPress.
Sample WordPress is already installed on new server so what we need to do is make a comparison between old and new server and copy the new files from old to new server. For that we need the following details,
1. Both servers’ name
2. Username and password of ftp server.
3. Username and password of WordPress account.
New server’s details can be retried from wp-config file and the old server’s details must be provided by the user. To do this, I planned to provide a new tab under WordPress setting dashboard so then it’ll be easy to enter the login details and by pressing the button the process will be conducted.
The starting point of this project will be a plug-in development because it easy to develop and fix the bugs. With the success I plan to move to WordPress core which will be little bit of harder.