X-Cart:Backup and Restore

From X-Cart 4 Classic
Revision as of 16:10, 27 January 2010 by Admin (talk | contribs) (Prerequisites)
Jump to: navigation, search

Overview

Backup generally refers to making a copy of a store, which can then be restored fast and easily, if need be. Regular data backup will help you prevent serious data loss and corruption that can follow a disaster or mishandling of your store. The rule here is to create a full backup copy of the store at regular intervals and before carrying out any tasks that may interfere with the software code and behavior, including software and hardware upgrades, custom programming, adjusting the store design, etc. At that, you should not rely on your hosting provider only, who is likely to include regular data backup into their hosting plan: In case of emergency, data cannot always be restored immediately while any possible delay can seriously affect your business. Another typical example of when you may need to back up your store is moving/copying the store to another host or directory. In such a situation, if a backup is available, you will be able to deploy a fully functioning copy of the store in a new location quickly.

When you create a backup copy of a store you need to carry out a number of typical steps and procedures, which include making a database dumb and creating an archive with the X-Cart code, templates and related files (images, static pages, the HTML catalog, files in the folder file/, etc.). In fact, X-Cart does not impose any restrictions on what tools you use to create a backup copy of your store - you can use any convenient facility, including SSH, FTP, phpMyAdmin, Remote Desktop, utilities that go with your hosting control panel and other available facilities. The exact set may vary depending on the operating system you use.

When you restore the store from a backup copy, it is supposed that you use the same tools and facilities to carry out inverse operations: restoring the store files from the archive and restoring the database content from the MySQL dump. In case you are restoring the store to a different location, in addition to this you will need to adjust some configuration settings.

For detailed instructions on how to handle store backups and carry out specific tasks, please refer to the following sections later in this chapter:

Remember that making a backup copy of a store and restoring the store from the backup are rather complicated tasks, which may become associated with a series of difficulties or even involve unpredictable effects. This document only provides a general description of the backup and restore procedures, and it does not intend to cover all types of situations that can occur while you back up or restore your store.

If you experience any difficulties in handling your store backups and you cannot find the answer in this document, you are welcome to address the alternative sources and services.

Backing up the Store

Prerequisites

Before you start making a back up copy of your store, make sure of the following:

  • You have enough free disk space on your server or hosting account where your store is installed.
To estimate the minimal required amount of free disk space correctly, you can use the following formula: 2 kilobytes (kB) per each product in the store database + size of the folder images/ + size of the folder files/ + 50 megabytes (MB).
For example, if your store database consists of 5000 products, the size of the folder images/ is 66.7MB and the size of the folder files/ is 35.77MB, then you need (2 kB * 5000)/1024 + 66.7MB + 35.77MB + 50MB = 9.76MB + 66.7MB + 35.77MB + 50MB = 162.23MB.
Note: If you do not have enough free disk space, try to remove the files that you do not longer use or move them to another location.
  • You can access your server or hosting account using one of these options: terminal SSH or Telnet access, FTP, remote desktop (available for Windows-based servers only), your hosting control panel.
Note: If you cannot access your server or hosting account via these or other alternative options, address your hosting team for help.
  • The directory to which you are going to save the backup copy has writable permissions.
  • The Customer area of your store is temporarily closed for maintenance.

Having the Customer area closed ensures that none of your website visitors will be able to shop through your store and place orders while you are backing up your store, and the backup will include all the info that is available by the moment you start this task.

To close the store for maintenance:

1. Log in to the Admin area.

2. Go to the General settings section (Administration menu -> General settings).

3. In the General options box, select the Check this to close your shop temporarily check box. If necessary, enter a key for accessing the Customer area into the Key for access to a temporarily closed shop field.

Maintaining-01.gif

4. Click the Save button.

From here on, all your store visitors will be automatically redirected to a special page saying that the store is temporarily inaccessible and can be visited later. To open the store back, log in to the Admin area and unselect the checkbox.

Backing up Store Database

Backing up Store Files

Restoring the Store from a Backup

Prerequisites

Restoring Store Files from Archive

Restoring Store Database from SQL Dump

Safety Tips

Troubleshooting