DBWBP.com has recently been the victim of a malicious SPAM bot script and got taken down for severals days. This was my own fault as I had some issues after my last server migration preventing me of properly updating joomla or my various extensions. The site was also also filled with unused and outdated extensions but since it was still working,  I procrastinated for months and did not fix it until I was warned by my current host that my account got suspended because several hundreds of SPAM e-mails were being routed from my hosting account. Since I had so many extensions/plugin from when I was trying out stuff while building the site, locating the compromised extension proved to be tricky and the script seemed to replicate and hide itself as php file on different location on my server. Not wanting to have any parts in the SPAMMING of hundreds of peoples around the globe, I decided the best course of action was to shut it down and rebuild the site from the ground up and only keeping the bare minimum to minimize the risk of any future incidents. One thing I wanted to avoid was copying/pasting the contents of all my articles and lose all their stats (hit counts, categories, tags etc...). It was also important for me to be able to keep all the comments my visitors lefts on my differents articles. There are a few free extensions that were made to easily migrate differents type of contents but it was mainly intended for peoples migrating from Joomla 1.5 to version 2.5 or 3.x but more importantly for me, there was no way to install anything on my infected site because of some restrictions applied by my host. This left me looking around for tutorial as I was not really that knowledgeable about SQL but couldn't find much. I figured it out and ot everything and now I am going to share this bit of informations in the hope it'll help out someone someday.


The things that I needed to migrate:




Article's comment (Jcomments)

Menu entry


First, we need to extract all those informations from your old web site's SQL database. To do so, we need to access the Joomla's database using PHPMyAdmin found in your hosting account's Cpanel.


Once in PHPMyAdmin, we need to select our Joomla's database. The name of the database will be different from site to site but it is usualy named something like Joom1234 but it can be different if you had chosen to use a custom name during the Joomla installation. It should be pretty easy to find as most personnal website only have one or 2 database. Once you have located the right database, we need to expand it by clicking the little + button on the left of the database name. This will list all the different tables.



The one we are interested in are the following (the xxx part is your database's prefix and differ from site to site):

xxx_content - Joomla's article database

xxx_menu - Joomla's menu database

xxx_categories - Joomla's article categories database

xxx_tags - Joomla's article's tags

xxx_jcomments - Article's comment from Jcomments plugin

Now we need to export thoses tables. There's a way to export them all at the same time but to avoid issues and since there is only a few table, I advise selecting and export the table's entry one table at a time. Jus taking everything can cause issue when you'll be importing them in your new site as it will give error if entry are already existing in the database where it is going to be imported. This way you can select only the specific entry you need, exclude the rest and avoid issues when you'll be importing them back into your new site later. To do so, select one of the table and you'll see all the entries apear on the main windws of PHPMyAdmin.


You can then select everything and then unselect the few items that are default entry that would already exist in your other database. Once you have checked everything you want to move, you can export the mbut be sure not to click the regualr EXport button at the top of the page, you want the one at the bottom of your listed entry on the right of ''With selected:''. If you use the regular Export button at the top, it will just export every entry of that table wihtout consideration to what entry you have selected prior. 


You just have to click ''Go'' on the next windows without modifying anything and it'll download a .SQL file on your computer.

Now there is a good chance that the database on your new server won't be named the same (unless you intentionnally named it the same). This is a problem because those database entries we just exported will refer to the old database prefix. Fortunatly, it is a prtty easy fix and we will be taking care of that on the next step.

To do this, we just need to open up our .SQL file in your favorite text editor. I highly recomment the exellent and free notepad++ as it is much better at formatting the text according to what it is and it is much more powerfull than your build-in text editor. After that it is just a matter of searching the file for the old database prefixe (the xxx_ part) and have the text editor replace all instance found with the new database prefix and then save the file.


 We are now ready to import our entries i nthe new site database. To do so, log into the Cpanel of your new site and then launch PHPMyAdmin. Select the Joomla's database and select the table you are working on (example xxx_contents) and click ''Import'' at the top.


Select your newly edited SQL file by clicking on ''Choose file'' and then click ''Go'' and it should start importing and complete hopefully withouts issues.


If you receive one of those, it is likely that one of the entries you were trying to import was already present on the new database. Try to go back and import only the entries that are not present on the new database.

 We're not done yet, unless you do not care about categories and tags. We now need to do the same process but with the categories, tags and menu table. Once you have finished importing the others tables you can log into your Joomla's backend and you should now see your old articles and hopefully your tags and categories also followed. If you get error when trying to make modification to an articles and such, you might need to go to your menu and categories manager and click ''rebuild''. It should take care of it. You will also need to reconfigure your differents menu item but that should be fairly easy.

In the case of articles comments, Jcomments, the extension I am using unfortunatly doesn't let you export/import it's own article. There is an import function but it is only meant to import comment from a different comments extension installed on the same site. So first I had to install Jcomments on my new site so that all it's table get created. Then I did the same process as for the article's database (exporting, replacing db's prefix and importing) and everything ported over effortlessly.

You can do the same with extension's settings and such. I also did this with hikashop's settings and product listing. It worked but I still need to figure out an issue with the product page not working.

Here you have it peoples, this is how I migrated my website's content without using extensions. The lessons of the story here: keep your Joomla's and extensions/plugins updated and fix issues as they arrise or you might end up harassing some poor guy on the other side of the globe about buying viagra and inheritting gazillion of dollard from a long lost relatives they never knew they had.


** Due to constant SPAM originating from the comments of this article, comments have been disabled. If you have questions or comments, you can e-mail me directly using the contact page **