GD Press Tools Pro, starting with version 4.2 has a restore and clone capability. This tutorial shows how to prepare backup and how to restore it or clone it on another location. Tutorial will change to follow changes in the GD Press Tools for both backup and restore script.
Procedures described here are for: GD Press Tools Pro: Version 4.2.0
Current restore script limitations:
- It can’t be used to restore or clone multisite installations.
To make a backup that can be restored or cloned, backup must fulfill these conditions:
- Your backup file must contain full website files and database.
- It must be created with GD Press Tools Pro 4.2 RC1 or later.
- File wp-config.php must be present in the archive.
- Do not manually change the backup archive.
Easiest way to create the archive for full backup, is to use Quick Backup (see image on the right).
- Open Backup panel for GD Press Tools.
- On top of the screen you will see red navigation buttons. Second button is called Run Quick Button. Click on it and popup will be displayed.
- Click Full Backup button in the popup. You will get a message that backup will start in the background.
- You can close Backup panel, or you can use any other part of WordPress, backup will not be disrupted.
- Depending on your website size and server speed, backup will be ready after several minutes. You can check the Backup -> Process Log for the status of the backup (Default task).
You can also schedule default backup task to create full backup, run periodically, email you when backup is ready or copy it to CDN or FTP. To create full backup with more options follow this procedure:
- Open Backup panel for GD Press Tools.
- Open Tasks tab. If you don’t have your own tasks, you can use Default task that is set for full backups and it’s used for Quick Backup also.
- Green button is used for one time run of the task, red button is to schedule job that will repeat. They have only one difference: scheduler will allow you to select how the task will repeat.
- Click on the green or red button and dialog will appear like the one on the image on the right.
- Once you set up everything, click on Run or Schedule buttons and backup will start based on the first run settings.
More information on backup module and creating custom tasks you will find in Resources at the bottom of this post.
Restore or Clone
Restore script is located in the plugins restore folder. But you can download it from the Backup panel by clicking on the Get Restore Script at the top of the page. Popup dialog for this is on the image on the right. For restore to work you need first to prepare your destination folder. This is no different than preparing folder to install WordPress from scratch.
- Destination folder must be empty before you start with the restore. If you have some files there that are needed, you can run restore, but some of them might be overwritten if they are in names conflict with WordPress files. Best to start with empty folder and than add extra file later.
- Destination folder must be writable. Restore script needs to create folders, unpack archive, edit some of the files. When you run the restore script it will check for this and will not continue if there is problem with access to the folder. Folder must be writable by the PHP scripts (same goes for WordPress). This setting depends on the server and how the PHP is executed. If the folder is writable for FTP access it doesn’t always mean that PHP scripts will have access too. If you are not sure about this, consult your hosting company support or documentation.
- Destination folder must be mapped to the domain name and must be accessible from the web. When you add domain to your server through control panel (cPanel, Plesk or anything else), usually you get the folder where the domain points to. This is the folder where you will use for restoring or cloning backup archive.
- Database for the restoration or cloning must exist on the mySQL server. Most hosting companies will not allow for any script to be able to create databases, so you must do this before starting the restore. Creating database depends on your hosting company and the server control panel you use (cPanel and Plesk are most common). Setting database including setting database user and user password.
Once you make sure that all this is ready, you can start the process. There are few different scenarios for the process depending on server you are restoring to and if you are using new domain on moving the old one. Also, if you are cloning the website, you can use same database as before, but you must change the tables prefix. I will explain each restoration step for different scenario usages. For this we will use example: we have made backup of the website with domain: www.mydomain.com. We will clone it to new domain: www.newsite.com.
- Prepare your server for www.newsite.com domain. Make sure that folder where the domain points is writable by the PHP scripts. If you are moving your website to a new server, domain name will remain the same.
- Create new database for the restoring or cloning. If you are running the process on the same server where you made the backup and you want to use same database, than everything is prepared already.
- Copy the ZIP archive with full backup and the restore script (gd-restore-backup.php) to the destination folder using FTP or your server control panel file manager.
- Now, using your browser access the restore script. If you are restoring to same domain, URL will be something like this: http://www.mydomain.com/gd-restore-backup.php. And if you are cloning to new domain and in a folder on the domain, URL can look like this: http://www. newsite .com/blog/gd-restore-backup.php.
- Script will run and fist will check if the folder is writable and the ZIP archive is valid. If it’s not, you will see error messages and you can’t go ahead until you fix the issues.
- If everything is OK, you will get first step like on the image bellow.
- Click Next Step button, so that plugin can unpack the full website backup and restore all files. This can take some time, depending on the server speed and the size of the backup. Unpacking is done using PclZIP class, and while it’s not the fastest method, it will work on every server.
- Step 3 is first part of database backup and it’s used to set up changes for database access and make sure that it’s OK before proceeding to restore database.
As you can see on the image above, you need to enter URL for the new website. If the URL is the same (restoring backup), leave it unchanged. Database information depends on the server you use, and initially, script will populate this data from the wp-config.php from the backup archive. Prefix for the table can be changed. Once you set everything, click on Test Database Settings to see if the data is OK and script can use the database. If the prefix you set is already in use in the database you set, you will get message about that. Only when all 3 items on the right of the buttons are OK, you can preceed to next step.
- Database restoration runs in the next step. What script does depends on the database settings, but full process is displayed on the image bellow.
If the table prefix is changed, or website URL is changed, script will change imported data. wp-config.php is changed last to insert new values for the database access.
- Last step is confirmation that process is done and that you need to check everything and than delete the restore script and backup archive.
- If everything went fine with the process, your website should be working right away.
Here are some useful links to help you with using plugin and backup module.
If you need help with this procedure, you can use forum to get help, if you have any suggestions, leave the comment here or in the forum. Restore procedure will be changed and updated with every new plugin version, and all those changes will be described here.