Support

Documentation

Unorthodox: the emergency restoration procedure

[Warning]Warning

THIS IS NOT THE REGULAR RESTORATION PROCEDURE.

I will say it again.

THIS IS ****NOT**** HOW YOU ARE SUPPOSED TO RESTORE BACKUPS!!!!!

You must follow these instructions ONLY if the restoration script which is included inside the backup archive, under the installation directory (ANGIE) is not working on your host and you really, REALLY are in a BIG hurry to get your site up and running.

And I will say it once more.

THIS IS NOT HOW YOU ARE SUPPOSED TO RESTORE BACKUP ARCHIVES UNDER NORMAL CIRCUMSTANCES.

[Note]Note

These instructions are meant to be first read before disaster strikes. Therefore, a fair amount of humour has been used throughout. If you try to read it after disaster struck you will naturally find the humorous parts inappropriate, or even offensive. Rest assured that this is because you are under a huge amount of stress. As soon as you'll have finished following the instructions herein, you will be able to re-read this document with a light heart and enjoy the humorous puns as they were intended.

Inevitably, some people will end up with a backup file, a ruined site and a problem in the restoration procedure they can't work out. Almost always, the recipe includes a pressing deadline which requires that the site is on-line... yesterday. If you are in a situation like the one we just described, breathe. Do not panic. We've got you covered, with this concise manual site restoration guide. So, here it goes... it's manual site restoration In a few steps.

Step 1. Making sure it won't get worse.

Assuming such a situation, it's only human to be in panic and despair. Panic is a bad counsellor. It will give you wrong advice. Despair will only make you careless. So, people, get it together! Make a backup of the only thing separating you from complete disaster: the backup file. Burn it on a CD. Write it on your USB key. Put it on a couple of locations on your file server. Just make sure you'll have an extra copy in case you screw up. Trust us on that; even pros can accidentally wipe out the only backup under pressure to get a site back on-line.

This exercise has been proven to lower the probability of anything going wrong. Furthermore, it's good for your psychology. It gives you a sense of security you didn't have five minutes ago.

Step 2. Extracting the archive.

Now, we have to extract the archive somewhere on your local hard drive.

If the archive is of the JPA type, you'll have to use Akeeba eXtract Wizard, available without charge from our website.

If you have a ZIP package, there are a couple of gotchas. If you are working on a Linux machine, unzip will work just fine. If you're on Windows and under certain configuration circumstances on the server you took the backup on, you might not be able to extract it with WinZIP, WinRAR, 7-Zip or other archiver software. So you'll have to use Akeeba eXtract Wizard available for free from our website. This is a GUI utility which allows direct extraction of backup archives on your computer.

Step 3. Editing your database backup.

Take a look at the directory where you extracted your backup archive. Inside it there is a directory named installation. Inside this, there is a subdirectory named sql. Inside this there is a file, site.sql, containing your database data. COPY THIS TO ANOTHER LOCATION NOW! We'll have to edit it, so please, don't tamper with the original.

[Important]Important

It is possible that your database backup is split in several parts which will have the filename site and extensions .s01, .s02, .s03 and so on. You will need to perform the instructions in steps 3 and 4 for ALL of these files.

Open the copy of site.sql. Use a text editor (we recommend gedit and Kate on Linux™, Notepad++ on Windows™ or TextWranger on Mac OS X™; do not use Wordpad, TextEdit or Word!). If you were ever familiar with SQL, you'll recognize that each line consists of a single SQL command. But they have a problem: table names are mangled. You'll see that tables are in a form similar to #__banner instead of something_banner. Ah, nice! We'll have to fix that.

Using your text editors Replace command, do the following changes:

  • search for CREATE TABLE `#__ replace with CREATE TABLE `jos_

  • search for DROP TABLE IF EXISTS `#__ replace with DROP TABLE IF EXISTS `jos_

  • search for INSERT INTO `#__ replace with INSERT INTO `jos_

  • search for CREATE VIEW `#__ replace with CREATE VIEW `jos_

  • search for CREATE PROCEDURE `#__ replace with CREATE PROCEDURE `jos_

  • search for CREATE FUNCTION `#__ replace with CREATE FUNCTION `jos_

  • search for CREATE TRIGGER `#__ replace with CREATE TRIGGER `jos_

The idea is to replace all instances of #__ (note that there are two underscores after the hash sign) with jos_ in the SQL command part (not the data part). DO NOT PERFORM A BLIND SEARCH AND REPLACE OF #__ WITH jos_ AS IT WILL CAUSE SEVERE PROBLEMS WITH SOME COMPONENTS. Easy, wasn't it? NOW SAVE THAT FILE!

Note: Instead of jos_ (which we use merely as an example) you may want to use the prefix used by your site's script. You can read it in the databases.ini which is found inside the installation/sql directory of the extracted backup.

Step 4. Restoring the database.

In order to restore the database on the server you'll have to use some appropriate tool. For small to moderately sized database dumps (up to 2Mb), we find that phpMyAdmin does the trick pretty well, plus it's installed on virtually all PHP enabled commercial hosts. For larger dumps, we found that bigdump.php from Alexey Ozerov works wonders. Another useful and very easy (or, should I say, easier) to use tool is Adminer. Use either of those tools - or any other of your liking - to restore your database.

Step 5. Upload your site's files.

First of all, delete the installation subdirectory from the directory you extracted the backup archive to. We won't be needing this any more. Then, using FTP - or any method you please - upload all of the files to the target server.

If you want to be thorough remember to set the directory and file permissions accordingly. If you just want to get the damn thing on-line ASAP, just skip this permissions thing; it will remind you of itself as soon as you try to do some website administration (like uploading a picture) after the site's back on-line.

Step 6. Edit your site's configuration file, if necessary.

This depends on the site script you are using, e.g. Joomla!, WordPress or something different. You need to edit the configuration file(s) of your site to make sure that the database information is correct. If you are using one of the supported scripts, here are the instructions you need to follow:

  • On Joomla!™ sites you have to edit the configuration.php file in your site's root. You can also take a guided tour to this file.

  • On WordPress™ sites you have to edit the wp-config.php file in your site's root. The WordPress Codex has detailed instructions.

If you are still unsure how to edit those files, or if your script is not in the list above, please contact the support forum of your site's script. Please do not ask us, all we can do is point you to the third-party instructions above. Even worse, if the script is not in the list above all we can realistically do is simply tell you to search Google or contact the support forum of your script as we can't possibly know how every single script (and its every version) out there is supposed to be configured.