Difference between revisions of "X-Cart:X-CloudBackup"

From X-Cart 4 Classic
Jump to: navigation, search
m (Configuring the X-CloudBackup add-on module)
(Cloud Backup)
 
(31 intermediate revisions by 2 users not shown)
Line 2: Line 2:
  
 
==Overview==
 
==Overview==
<u>X-CloudBackup</u> is an add-on module for X-Cart that allows you to protect your ecommerce data with backups. With this convenient module you will never again have to worry about losing your store's files or database: all you'll need to do is set up a backup schedule and specify where you want backups to be uploaded - the system will take care of the rest. In addition to running backups automatically on a schedule, <u>X-CloudBackup</u> makes it possible to run backups manually (like before an upgrade or making a change to your site - just in case something goes wrong).
+
X-CloudBackup is an add-on module for X-Cart that allows you to protect your ecommerce data with backups. With this convenient module you will never again have to worry about losing your store's files or database: all you'll need to do is set up a backup schedule and specify where you want backups to be uploaded - Dropbox, Google Drive or an FTP server of your choice - and the system will take care of the rest. In addition to running backups automatically on a schedule, X-CloudBackup makes it possible to run backups manually (like before an upgrade or making a change to your site - just in case something goes wrong).
  
====Key features====
+
Key features:
 +
:* Automatic, regularly scheduled backups. It is possible to schedule backups to be run periodically (every day, every week) and even specify the exact date and time when your next backup must be run. Once you have configured your settings, your store's data will be backed up automatically based on the schedule you defined: no chance of "forgetting" a vital backup and permanently losing irreplaceable data.
 
:*  One-click backups. Your entire store can be backed up with a single click of a button; just configure your preferences and rest assured that your precious data will be safe.
 
:*  One-click backups. Your entire store can be backed up with a single click of a button; just configure your preferences and rest assured that your precious data will be safe.
 
:* Adjustable backup scope. Decide whether you want to back up your X-Cart store's database, files or both. Exclude specific directories or files from backup as you wish.
 
:* Adjustable backup scope. Decide whether you want to back up your X-Cart store's database, files or both. Exclude specific directories or files from backup as you wish.
:* Automatic, regularly scheduled backups. It is possible to specify the time when your next backup must be run or schedule backups to be run periodically (every day, every week). Once you have configured your settings, your store's data will be backed up automatically based on the schedule you defined: no chance of “forgetting” a vital backup and permanently losing irreplaceable data.
 
 
:* Instant upload to Dropbox, Google Drive or FTP server of your choice. Add an extra layer of protection by housing your backup somewhere other than your primary server, so if something goes wrong with your server, your data will be safe. The module can automatically upload generated backups to Dropbox, Google Drive or any FTP server you specify. It is even possible to use more than one storage location at a time.
 
:* Instant upload to Dropbox, Google Drive or FTP server of your choice. Add an extra layer of protection by housing your backup somewhere other than your primary server, so if something goes wrong with your server, your data will be safe. The module can automatically upload generated backups to Dropbox, Google Drive or any FTP server you specify. It is even possible to use more than one storage location at a time.
  
==System requirements==
+
==Quick Start==
 +
To start using Cloud Backup at your X-Cart store, follow these steps:
 +
# Install the X-CloudBackup add-on module in X-Cart (See [[#X-CloudBackup system requirements|X-CloudBackup system requirements]] and [[#Installing the X-CloudBackup add-on module|Installing the X-CloudBackup add-on module]]).
 +
# Enable the module in X-Cart's back end (See [[#Enabling the X-CloudBackup add-on module|Enabling the X-CloudBackup add-on module]]).
 +
# On the X-CloudBackup module configuration page, specify your preferences in the ''General settings'' section (See [[#Configuring the X-CloudBackup add-on module|Configuring the X-CloudBackup add-on module]]).
 +
# On the same page, specify the storage location(s) to which you would like backups to be saved/uploaded by selecting the respective check box(es):
 +
#* Dropbox: Enable the option "Enable upload to Dropbox".
 +
#* Local Storage: Enable the option "Save to local storage".
 +
#* FTP: Enable the option "Enable upload to ftp server".
 +
#* Google Drive: Enable the option "Use Google Drive".
 +
# Configure the selected storage(s) and connect it/them to X-CloudBackup:
 +
#* Dropbox: See [[#Configuring Dropbox storage|Configuring Dropbox storage]].
 +
#* Local Storage: Specify the path to the local directory where you would like store backups to be saved.
 +
#* FTP: Specify the details for connecting to your preferred FTP server and the path to the directory on that server where you would like store backups to be saved.
 +
#* Google Drive: See [[#Configuring Google Drive storage|Configuring Google Drive storage]].
 +
# Configure your favourite scheduling program to periodically run the script <u>cron_backup.php</u> (See [[#Running the script cron_backup.php|Running the script cron_backup.php]]). NB: This step is required, no matter whether you are going to run backups on a schedule or just use manual one-click backups. '''Running <u>cron_backup.php</u> is essential for the correct operation of the module.'''
 +
 
 +
After completing the above steps you should be able to run backups using the X-CloudBackup module (See [[#Using the X-CloudBackup add-on module|Using the X-CloudBackup add-on module]]).
 +
 
 +
==X-CloudBackup system requirements==
 
To be able to successfully install and use the <u>X-CloudBackup</u> add-on module, you need to have an installed working copy of X-Cart 4.1.x or later. Make sure that the version of the module is the same as the version of your installed copy of X-Cart.
 
To be able to successfully install and use the <u>X-CloudBackup</u> add-on module, you need to have an installed working copy of X-Cart 4.1.x or later. Make sure that the version of the module is the same as the version of your installed copy of X-Cart.
  
Line 35: Line 54:
 
#: b) Decompress the package using the following command:
 
#: b) Decompress the package using the following command:
 
#: <pre>tar -xzvf X-CloudBackup-x.y.z.tgz</pre>
 
#: <pre>tar -xzvf X-CloudBackup-x.y.z.tgz</pre>
#: {{Note1|'''Important:''' Make sure you keep the directory structure while unpacking and uploading the distribution package, otherwise some necessary files can be overwritten! }}
+
#: {{Note1|'''Important:''' Make sure you keep the directory structure while unpacking and uploading the distribution package, otherwise some necessary files may be overwritten! }}
# In a web browser, run the installation script <u>httр://<YOUR_XCART_DOMAIN>/install-xbackup.php</u> replacing the variable <u><YOUR_XCART_DOMAIN></u> with the actual domain name of your X-Cart based store.
+
# In a web browser, run the installation script <u>httр://<YOUR_XCART_DOMAIN>/install-xbackup.php</u> replacing <u><YOUR_XCART_DOMAIN></u> with the actual domain name of your X-Cart based store.
 
# Enter the [[X-Cart:FAQs#What_is_Auth_code_and_where_can_I_find_it.3F|Auth code]], accept the License Agreement and click the Next button.<br />
 
# Enter the [[X-Cart:FAQs#What_is_Auth_code_and_where_can_I_find_it.3F|Auth code]], accept the License Agreement and click the Next button.<br />
# The installation script patches the files and activates the module. Click '''Next''' to continue the installation.<br />{{Note1|Note: if you are using a custom skin, you will need to manually apply the patches to it. Otherwise, the module will not work in this skin. For more info, see [[#How to patch a 3rd party skin after the installation of the Rich Google Search Results module|How to patch a 3rd party skin after the installation of the X-CloudBackup module]].}}
+
# The installation script patches the files and activates the module. Click '''Next''' to continue the installation.<br />{{Note1|Note: If you are using a custom skin, you will need to manually apply the patches to it. Otherwise, the module will not work in this skin. For more info, see [[#How to patch a 3rd party skin after the installation of the X-CloudBackup module|How to patch a 3rd party skin after the installation of the X-CloudBackup module]].}}
 
# The installation script generates a new system fingerprint. Click '''Next''' to complete the installation.
 
# The installation script generates a new system fingerprint. Click '''Next''' to complete the installation.
 
# Use the ADMINISTRATOR AREA link to log in to the Admin area.
 
# Use the ADMINISTRATOR AREA link to log in to the Admin area.
Line 44: Line 63:
 
== Enabling the X-CloudBackup add-on module==
 
== Enabling the X-CloudBackup add-on module==
  
After the <u>X-CloudBackup</u> add-on module installation has been completed, the module you have installed needs to be enabled in your store:
+
After the X-CloudBackup add-on module installation has been completed, the module you have installed needs to be enabled in your store:
  
 
# In Admin area, go to the <u>Modules</u> section (<u>Settings menu->Modules</u>).
 
# In Admin area, go to the <u>Modules</u> section (<u>Settings menu->Modules</u>).
# Choose the <u>X-CloudBackup</u> module by selecting the respective check box on the left.
+
# Choose the X-CloudBackup module by selecting the respective check box on the left.
 
# Click the '''Apply changes''' button. This activates the module.<br /><br />
 
# Click the '''Apply changes''' button. This activates the module.<br /><br />
 
 
 
 
 
  
 
==Configuring the X-CloudBackup add-on module==
 
==Configuring the X-CloudBackup add-on module==
  
After the <u>X-CloudBackup</u> add-on module has been enabled in your store, you should check and adjust its configuration:
+
After the X-CloudBackup add-on module has been enabled in your store, you should check and adjust its configuration:
  
 
# In the <u>Modules</u> section (<u>Settings menu->Modules</u>), click the <u>Configure</u> link opposite the module name ('X-CloudBackup').<br />The module configuration page (titled by the name of the module) opens:
 
# In the <u>Modules</u> section (<u>Settings menu->Modules</u>), click the <u>Configure</u> link opposite the module name ('X-CloudBackup').<br />The module configuration page (titled by the name of the module) opens:
Line 67: Line 81:
 
===X-CloudBackup module configuration settings===
 
===X-CloudBackup module configuration settings===
 
'''General settings'''
 
'''General settings'''
:* '''Send email notifications about completed backups to site administrator''': Enable this option if you want information about each completed backup (as seen on the ''Last backup info'' tab of the '''X-CloudBackup''' page) to be sent to the store administrator's email address.
+
:* Send email notifications about completed backups to site administrator: Enable this option if you want information about each completed backup (as seen on the '''Last backup info''' tab of the '''X-CloudBackup''' page) to be sent to the store administrator's email address.
:* '''Backup files''': Enable this option if you want your X-Cart store's files to be backed up.  
+
:* Backup files: Enable this option if you want your X-Cart store's files to be backed up.
:* '''Backup database''': Enable this option if you want your X-Cart store's database to be backed up.
+
:* Backup database: Enable this option if you want your X-Cart store's database to be backed up.
:* '''Maximum number of backups on storages (0 - unlimited)''':
+
:* Maximum number of backups on storages (0 - unlimited): Specify the maximum number of backup archive files that you want to be stored (per storage location). When this number is exceeded, the oldest backup archive file will be replaced with the new one.
:* '''Excluded files''': If certain files or directories under your X-Cart installation directory do not need to be backed up, specify them here - they will not be included.
+
:* Excluded files: If certain files or directories under your X-Cart installation directory do not need to be backed up, specify them here - they will not be included.<br />Format:
 +
:: folder_name/* - This excludes the folder "folder_name" and all the files in this folder from the backup archive.
 +
:: folder_name/file_name.txt - This excludes the file "folder_name/file_name.txt" from the backup archive.
 +
 
 
'''Dropbox'''
 
'''Dropbox'''
 +
:* Enable upload to Dropbox: Enable this option if you want backups to be uploaded to your Dropbox account. After doing so, be sure to connect X-CloudBackup with your Dropbox account (See [[#Configuring Dropbox storage|Configuring Dropbox storage]]).
 +
 
'''Local Storage'''
 
'''Local Storage'''
 +
:* Save to local storage: Enable this option if you want backups to be saved locally on the server where your X-Cart store is installed.
 +
:* Path to backup directory: Enter the path to the directory in which backups are to be saved.
 +
 
'''FTP'''
 
'''FTP'''
 +
:* Enable upload to ftp server: Enable this option if you want backups to be uploaded to an FTP server.
 +
:* FTP host: Enter the host name of the FTP server on which backups are to be stored.
 +
:* FTP login and FTP password: Enter your FTP account username and password.
 +
:* FTP folder: Enter the name of the folder to which backups are to be saved.
 +
 
'''Google Drive'''
 
'''Google Drive'''
 +
:* Use Google Drive: Enable this option if you want backups to be uploaded to Google Drive.
 +
:* Client Id and Client Secret: Enter the Client Id and Client Secret obtained from Google (See [[#Configuring Google Drive storage|Configuring Google Drive storage]]).
  
====Configuring Google Drive storage====
+
==Preparing to use X-CloudBackup==
 +
===Configuring Dropbox storage===
 +
To enable the X-CloudBackup module to upload backups to Dropbox, you must connect your Dropbox account with X-CloudBackup.
 +
Follow these steps:
 +
# In X-Cart's Admin area, go to the '''X-CloudBackup''' page (Click Tools menu->X-CloudBackup or use the <u>Configure</u> link shown next to the "Enable upload to Dropbox" option on the [[#Configuring the X-CloudBackup add-on module|X-CloudBackup module configuration page]]).
 +
# On the '''Storages settings''' tab, locate the section titled '''Dropbox settings'''. Before you have connected your Dropbox account with X-CloudBackup, this section contains a message saying "You should connect your Dropbox account with X-CloudBackup. Please use this link."<br />[[File:Storages_settings.png]]
 +
# Follow the link. You will be redirected to Dropbox.
 +
# Sign in to your existing Dropbox account or create a new one.
 +
# After signing in to Dropbox, you will be asked to provide permission for the X-Backup application to create a folder "x_backup" in your Dropbox account. Allow the creation of the "x_backup" folder (This is where your store's backups will be stored). The folder will be created automatically, after which you will be redirected back to the '''X-CloudBackup''' page in your X-Cart store.
 +
That is all - your Dropbox account is now connected to X-CloudBackup. The '''Dropbox settings''' section now shows your Dropbox account info:
 +
::[[File:Storages_settings_dropbox.png]]
 +
Should you decide to stop using X-CloudBackup with Dropbox, you can revoke the connection at any time using the '''Revoke access''' button.
 +
 
 +
===Configuring Google Drive storage===
  
 
# Create an API project in the [https://code.google.com/apis/console/ Google APIs Console]
 
# Create an API project in the [https://code.google.com/apis/console/ Google APIs Console]
 +
# Select the '''Services''' tab in your API project, and enable the Drive API.
 +
#  Select the '''API Access''' tab in your API project, and click '''Create an OAuth 2.0 client ID'''.
 +
#  In the '''Branding Information''' section, provide a name for your application (e.g. "Backup for my store"), and click '''Next'''. Providing a product logo is optional.
 +
#  In the '''Client ID Settings''' section, do the following:
 +
## Select Web application for the Application type.
 +
## Click "(<u>more options</u>)" on the line "Your site or hostname".
 +
## In the Authorized Redirect URIs box, enter https://YOUR_XCART_DOMAIN/admin/xbackup.php (Be sure to replace the "YOUR_XCART_DOMAIN" portion of the URI with your actual domain name). Generally, it is possible to use http://, but https:// is more secure.
 +
## Click '''Create Client ID'''.
 +
#  On the '''API Access''' page, locate the section '''Client ID for web applications''' and note or copy the two pieces of information: Client ID and Client Secret.
 +
# Log in to your X-Cart store's Admin area.<br />'''Important:''' If you entered the Authorized Redirect URI as https:// (and that is what we recommend), be sure to log in to Admin using HTTPS. HTTPS will be needed only this one time to connect the module with your Google Drive account (The URI of the page from which you will be connecting to Google Drive must be the exact match of the Authorized Redirect URI you entered while creating your Client ID, including the protocol; hence the need for HTTPS).
 +
# Go to the [[#Configuring the X-CloudBackup add-on module|X-CloudBackup module configuration page]] and enter the Client ID and Client Secret values in the '''Google Drive''' section. Be sure to save the changes.
 +
# Still in your store's Admin area, go to the '''X-CloudBackup''' page (Click Tools menu->X-CloudBackup or use the <u>Configure</u> link shown next to the "Enable upload to Dropbox" option on the [[#Configuring the X-CloudBackup add-on module|X-CloudBackup module configuration page]]).
 +
# On the '''Storages settings''' tab, locate the section titled '''Google Drive settings'''. Before you have connected your Google Drive account with X-CloudBackup, this section contains a message saying "You should connect your Google Drive account with X-CloudBackup. Please use this link."<br />[[File:Storages_settings1.png]]
 +
# Follow the link. You will be redirected to Google.
 +
# When prompted, provide permission for the created application ("Backup for my store" or whatever name you gave it) to view and manage the files and documents in your Google Drive (Click Accept). After this you will be redirected back to the '''X-CloudBackup''' page in your X-Cart store.
 +
That is all - your Google Drive account is now connected to X-CloudBackup. The '''Google Drive settings''' section now shows your Google Drive account info:
 +
::[[File:Storages_settings_googledrive.png]]
 +
Should you decide to stop using X-CloudBackup with Google Drive, you can revoke the connection at any time using the '''Revoke access''' button.
  
# Select the Services tab in your API project, and enable the Drive API.
+
===Running the script cron_backup.php===
#  Select the API Access tab in your API project, and click Create an OAuth 2.0 client ID.
 
#  In the Branding Information section, provide a name for your application (e.g. "Backup for my store"), and click Next. Providing a product logo is optional.
 
#  In the Client ID Settings section, do the following:
 
#: Select Installed application for the Application type
 
#: Select Other for the Installed application type.
 
#: Click Create Client ID.
 
#  In the API Access page, locate the section Client ID for installed applications and note or copy the two pieces of information: the Client ID and the Client Secret.
 
#  You need to copy and paste Client ID and the Client Secret to X-CloudBackup settings page
 
<br/>
 
  
====Excluding files from backup archive====
+
X-CloudBackup provides a script <u>cron_backup.php</u> that must be periodically executed from the command line for correct operation of the module. This script ensures launch of scheduled and on demand backups regardless of whether the browser is open. The recommended frequency for running <u>cron_backup.php</u> is once per 5-10 minutes. We recommend to launch this script using your favorite scheduling program (for example [http://en.wikipedia.org/wiki/Cron | cron daemon] in Unix/Linux systems).
  
If you want to exclude some files from a backup archive, you have to fill field "Excluded files".
+
<b>Recommended setup for running the cron_backup.php script via crontab:</b>
 
 
::* <b>folder_name/*</b> - it is format to exclude folder with name "folder_name" and with all files in this folder from the backup archive.
 
::* <b>folder_name/file_name.txt</b> - it is format to exclude specific file from the backup archive
 
<br/>
 
 
 
====Running cron_backup.php script====
 
 
 
X-CloudBackup provides a script <u>cron_backup.php</u>, which must be executed from the command line. You can use this script to launch execution of periodic backup tasks, necessary for correct operation of the module.It is recommended to launch this script using your favorite scheduling program (for example [http://en.wikipedia.org/wiki/Cron | cron daemon] in Unix/Linux systems) once per 5-10 minutes.
 
 
 
<b>Recommended setup for running cron_backup.php script via crontab:</b>
 
 
<pre>
 
<pre>
 
*/5 * * * * cd /path/to/your/xcart; /path/to/php -d safe_mode=Off cron_backup.php --key=c901d65fc15ff15d0ac0af967437d051
 
*/5 * * * * cd /path/to/your/xcart; /path/to/php -d safe_mode=Off cron_backup.php --key=c901d65fc15ff15d0ac0af967437d051
 
</pre>
 
</pre>
  
::* <b>*/5 * * * *</b> - to run script every 5 minutes
+
::* <b>*/5 * * * *</b> - to run the script every 5 minutes
::* <b>cd /path/to/your/xcart</b> - to change dir to x-cart folder on your server
+
::* <b>cd /path/to/your/xcart</b> - to change dir to X-Cart folder on your server
 
::* <b>/path/to/php</b> - path to PHP 5.3.1 CLI binary on your server
 
::* <b>/path/to/php</b> - path to PHP 5.3.1 CLI binary on your server
 
::* <b>-d safe_mode=Off</b> - to execute cron_backup.php script
 
::* <b>-d safe_mode=Off</b> - to execute cron_backup.php script
::* <b>--key=c901d65fc15ff15d0ac0af967437d051</b> - secure key defined in x-cart General Settings:      Secure key for launching the cron.php script
+
::* <b>--key=c901d65fc15ff15d0ac0af967437d051</b> - secure key defined in X-Cart's [[X-Cart:General_Options|General Settings]] ("Secure key for launching the cron.php script")
 
<br/>
 
<br/>
  
==Managing the X-CloudBackup add-on module==
+
==Using the X-CloudBackup add-on module==
 +
 
 +
After you have installed and configured the X-CloudBackup add-on module in your store, connected it with the storages where backups are to be uploaded and set up a scheduling program to periodically run <u>cron_backup.php</u>, all is ready for you to start using the module for backing up your store's data.
 +
 
 +
{{Note1|'''Important:''' Before choosing to run a manual backup or scheduling backups to be run automatically, please be sure to set up a scheduling program to periodically run the script <u>cron_backup.php</u>. X-CloudBackup will not be able to run any backups without it.}}
 +
 
 +
In your store's Admin area, go to the <u>X-CloudBackup</u> page (<u>Tools</u>-><u>X-CloudBackup</u>):
 +
:[[Image:Manage_cloud_backup.png |border]]<br/>
 +
 
 +
At the top of this page, a button titled '''Backup now''' is provided; this button can be used to run a backup at any time.
 +
 
 +
Also, you can see three tabs: '''Storages settings''', '''Last backup info''' and '''Backup files'''.
 +
 
 +
The '''Storages settings''' tab is where you set the frequency at which your store is to be backed up (''Daily'', ''Weekly'') and the exact time and date when the following backup is to be run.
 +
 
 +
{{Note1|'''Note:''' Actual backup times depend on when the script <u>cron_backup.php</u> is run. For example, when you click '''Backup now''', the backup process is not started immediately; the module simply writes to the database that the following backup must be run not according to the defined schedule, but at the earliest opportunity. Next time that cron runs <u>cron_backup.php</u>, a check is conducted to determine whether it is time for a previously scheduled backup or whether a backup has been demanded manually. If one of the conditions is true, the backup process is launched.}}
 +
 
 +
The '''Last backup info''' tab provides information about the last time your store's data was backed up:
 +
:[[Image:Manage_cloud_backup2.png |border]]
 +
{{Note1|'''Note:''' Messages like "Delete old files... Files were deleted: backup_xx_xx_xx_xx_xx.zip" in the screenshot above reflect the deletion of older backup files being removed to make room for new backup files as defined by the '''Maximum number of backups on storages''' setting.}}
 +
 
 +
The '''Backup files''' tab provides a list of available (currently stored) backup archive files:
 +
:[[Image:Manage_cloud_backup3.png |border]]
 +
If a backup file is removed from any of the storages, it is also removed from the list; this way you can find out what backup files are available and where at any moment just by looking at the contents of the '''Backup files''' tab.
  
 +
==How to patch a 3rd party skin after the installation of the X-CloudBackup module==
  
# In Admin area, go to the <u>X-CloudBackup page</u> section (<u><u>Tools->X-CloudBackup page</u></u>). On this page you should connect X-CloudBackup with your Dropbox or Google Drive accounts and setup frequency and time of backuping.<br/>[[Image:Manage_cloud_backup.png |border]]<br/>
+
[[Category:X-Cart modules]]
# On the tab "Last backup info" you can find information about the last backuping.<br/>[[Image:Manage_cloud_backup2.png |border]]<br/>
 
# The list of the backup archive files is showing on the tab "Backup files".<br/>[[Image:Manage_cloud_backup3.png |border]]<br/>
 

Latest revision as of 19:07, 18 June 2018

X-Cart4.1.x-4.5.x

Overview

X-CloudBackup is an add-on module for X-Cart that allows you to protect your ecommerce data with backups. With this convenient module you will never again have to worry about losing your store's files or database: all you'll need to do is set up a backup schedule and specify where you want backups to be uploaded - Dropbox, Google Drive or an FTP server of your choice - and the system will take care of the rest. In addition to running backups automatically on a schedule, X-CloudBackup makes it possible to run backups manually (like before an upgrade or making a change to your site - just in case something goes wrong).

Key features:

  • Automatic, regularly scheduled backups. It is possible to schedule backups to be run periodically (every day, every week) and even specify the exact date and time when your next backup must be run. Once you have configured your settings, your store's data will be backed up automatically based on the schedule you defined: no chance of "forgetting" a vital backup and permanently losing irreplaceable data.
  • One-click backups. Your entire store can be backed up with a single click of a button; just configure your preferences and rest assured that your precious data will be safe.
  • Adjustable backup scope. Decide whether you want to back up your X-Cart store's database, files or both. Exclude specific directories or files from backup as you wish.
  • Instant upload to Dropbox, Google Drive or FTP server of your choice. Add an extra layer of protection by housing your backup somewhere other than your primary server, so if something goes wrong with your server, your data will be safe. The module can automatically upload generated backups to Dropbox, Google Drive or any FTP server you specify. It is even possible to use more than one storage location at a time.

Quick Start

To start using Cloud Backup at your X-Cart store, follow these steps:

  1. Install the X-CloudBackup add-on module in X-Cart (See X-CloudBackup system requirements and Installing the X-CloudBackup add-on module).
  2. Enable the module in X-Cart's back end (See Enabling the X-CloudBackup add-on module).
  3. On the X-CloudBackup module configuration page, specify your preferences in the General settings section (See Configuring the X-CloudBackup add-on module).
  4. On the same page, specify the storage location(s) to which you would like backups to be saved/uploaded by selecting the respective check box(es):
    • Dropbox: Enable the option "Enable upload to Dropbox".
    • Local Storage: Enable the option "Save to local storage".
    • FTP: Enable the option "Enable upload to ftp server".
    • Google Drive: Enable the option "Use Google Drive".
  5. Configure the selected storage(s) and connect it/them to X-CloudBackup:
    • Dropbox: See Configuring Dropbox storage.
    • Local Storage: Specify the path to the local directory where you would like store backups to be saved.
    • FTP: Specify the details for connecting to your preferred FTP server and the path to the directory on that server where you would like store backups to be saved.
    • Google Drive: See Configuring Google Drive storage.
  6. Configure your favourite scheduling program to periodically run the script cron_backup.php (See Running the script cron_backup.php). NB: This step is required, no matter whether you are going to run backups on a schedule or just use manual one-click backups. Running cron_backup.php is essential for the correct operation of the module.

After completing the above steps you should be able to run backups using the X-CloudBackup module (See Using the X-CloudBackup add-on module).

X-CloudBackup system requirements

To be able to successfully install and use the X-CloudBackup add-on module, you need to have an installed working copy of X-Cart 4.1.x or later. Make sure that the version of the module is the same as the version of your installed copy of X-Cart.

Note: If you do not remember the version of X-Cart on which your store is based, you can look it up in the Environment info section of the Summary page in X-Cart Admin area.

X-CloudBackup system requirements are as follows:

  • PHP version >= 5.3.1
  • cURL PHP extension
  • One of the following PHP functions available: exec, system or passthru
  • crontab or other scheduling program on your server
  • zip and mysqldump programs on your server

Installing the X-CloudBackup add-on module

To install the module:

  1. Obtain the X-CloudBackup add-on module distribution package by downloading it from the File Area section of your X-Cart Account. The distribution package you need is contained in the archive file X-CloudBackup-x.y.z.tgz where x, y and z stand for X-Cart version (These need to match the version of X-Cart on which your store is based).
  2. Copy the distribution package to the X-Cart root directory on your server or hosting account.
    • If you use a Windows-based server, or a UNIX-based server without terminal access:
    a) Decompress the archive with the X-CloudBackup distribution package to a directory on your system using your favorite compression program (WinZIP or any other archiver with support for TAR files).
    b) Use an FTP client to upload all the files contained in the archive (retaining the directory structure) to the X-Cart root directory on your server or your hosting account.
    • If you use a UNIX-based server with terminal access:
    a) Use an FTP client to upload the archive with the distribution package to the X-Cart root directory on your server or your hosting account.
    b) Decompress the package using the following command:
    tar -xzvf X-CloudBackup-x.y.z.tgz
    Important: Make sure you keep the directory structure while unpacking and uploading the distribution package, otherwise some necessary files may be overwritten!
  3. In a web browser, run the installation script httр://<YOUR_XCART_DOMAIN>/install-xbackup.php replacing <YOUR_XCART_DOMAIN> with the actual domain name of your X-Cart based store.
  4. Enter the Auth code, accept the License Agreement and click the Next button.
  5. The installation script patches the files and activates the module. Click Next to continue the installation.
    Note: If you are using a custom skin, you will need to manually apply the patches to it. Otherwise, the module will not work in this skin. For more info, see How to patch a 3rd party skin after the installation of the X-CloudBackup module.
  6. The installation script generates a new system fingerprint. Click Next to complete the installation.
  7. Use the ADMINISTRATOR AREA link to log in to the Admin area.

Enabling the X-CloudBackup add-on module

After the X-CloudBackup add-on module installation has been completed, the module you have installed needs to be enabled in your store:

  1. In Admin area, go to the Modules section (Settings menu->Modules).
  2. Choose the X-CloudBackup module by selecting the respective check box on the left.
  3. Click the Apply changes button. This activates the module.

Configuring the X-CloudBackup add-on module

After the X-CloudBackup add-on module has been enabled in your store, you should check and adjust its configuration:

  1. In the Modules section (Settings menu->Modules), click the Configure link opposite the module name ('X-CloudBackup').
    The module configuration page (titled by the name of the module) opens:
    Settings cloud backup.png
  2. Adjust the settings on the module configuration page. Detailed information regarding the X-CloudBackup module configuration settings is available below.
  3. Click the Apply changes button to save the changes.


X-CloudBackup module configuration settings

General settings

  • Send email notifications about completed backups to site administrator: Enable this option if you want information about each completed backup (as seen on the Last backup info tab of the X-CloudBackup page) to be sent to the store administrator's email address.
  • Backup files: Enable this option if you want your X-Cart store's files to be backed up.
  • Backup database: Enable this option if you want your X-Cart store's database to be backed up.
  • Maximum number of backups on storages (0 - unlimited): Specify the maximum number of backup archive files that you want to be stored (per storage location). When this number is exceeded, the oldest backup archive file will be replaced with the new one.
  • Excluded files: If certain files or directories under your X-Cart installation directory do not need to be backed up, specify them here - they will not be included.
    Format:
folder_name/* - This excludes the folder "folder_name" and all the files in this folder from the backup archive.
folder_name/file_name.txt - This excludes the file "folder_name/file_name.txt" from the backup archive.

Dropbox

  • Enable upload to Dropbox: Enable this option if you want backups to be uploaded to your Dropbox account. After doing so, be sure to connect X-CloudBackup with your Dropbox account (See Configuring Dropbox storage).

Local Storage

  • Save to local storage: Enable this option if you want backups to be saved locally on the server where your X-Cart store is installed.
  • Path to backup directory: Enter the path to the directory in which backups are to be saved.

FTP

  • Enable upload to ftp server: Enable this option if you want backups to be uploaded to an FTP server.
  • FTP host: Enter the host name of the FTP server on which backups are to be stored.
  • FTP login and FTP password: Enter your FTP account username and password.
  • FTP folder: Enter the name of the folder to which backups are to be saved.

Google Drive

  • Use Google Drive: Enable this option if you want backups to be uploaded to Google Drive.
  • Client Id and Client Secret: Enter the Client Id and Client Secret obtained from Google (See Configuring Google Drive storage).

Preparing to use X-CloudBackup

Configuring Dropbox storage

To enable the X-CloudBackup module to upload backups to Dropbox, you must connect your Dropbox account with X-CloudBackup. Follow these steps:

  1. In X-Cart's Admin area, go to the X-CloudBackup page (Click Tools menu->X-CloudBackup or use the Configure link shown next to the "Enable upload to Dropbox" option on the X-CloudBackup module configuration page).
  2. On the Storages settings tab, locate the section titled Dropbox settings. Before you have connected your Dropbox account with X-CloudBackup, this section contains a message saying "You should connect your Dropbox account with X-CloudBackup. Please use this link."
    Storages settings.png
  3. Follow the link. You will be redirected to Dropbox.
  4. Sign in to your existing Dropbox account or create a new one.
  5. After signing in to Dropbox, you will be asked to provide permission for the X-Backup application to create a folder "x_backup" in your Dropbox account. Allow the creation of the "x_backup" folder (This is where your store's backups will be stored). The folder will be created automatically, after which you will be redirected back to the X-CloudBackup page in your X-Cart store.

That is all - your Dropbox account is now connected to X-CloudBackup. The Dropbox settings section now shows your Dropbox account info:

Storages settings dropbox.png

Should you decide to stop using X-CloudBackup with Dropbox, you can revoke the connection at any time using the Revoke access button.

Configuring Google Drive storage

  1. Create an API project in the Google APIs Console
  2. Select the Services tab in your API project, and enable the Drive API.
  3. Select the API Access tab in your API project, and click Create an OAuth 2.0 client ID.
  4. In the Branding Information section, provide a name for your application (e.g. "Backup for my store"), and click Next. Providing a product logo is optional.
  5. In the Client ID Settings section, do the following:
    1. Select Web application for the Application type.
    2. Click "(more options)" on the line "Your site or hostname".
    3. In the Authorized Redirect URIs box, enter https://YOUR_XCART_DOMAIN/admin/xbackup.php (Be sure to replace the "YOUR_XCART_DOMAIN" portion of the URI with your actual domain name). Generally, it is possible to use http://, but https:// is more secure.
    4. Click Create Client ID.
  6. On the API Access page, locate the section Client ID for web applications and note or copy the two pieces of information: Client ID and Client Secret.
  7. Log in to your X-Cart store's Admin area.
    Important: If you entered the Authorized Redirect URI as https:// (and that is what we recommend), be sure to log in to Admin using HTTPS. HTTPS will be needed only this one time to connect the module with your Google Drive account (The URI of the page from which you will be connecting to Google Drive must be the exact match of the Authorized Redirect URI you entered while creating your Client ID, including the protocol; hence the need for HTTPS).
  8. Go to the X-CloudBackup module configuration page and enter the Client ID and Client Secret values in the Google Drive section. Be sure to save the changes.
  9. Still in your store's Admin area, go to the X-CloudBackup page (Click Tools menu->X-CloudBackup or use the Configure link shown next to the "Enable upload to Dropbox" option on the X-CloudBackup module configuration page).
  10. On the Storages settings tab, locate the section titled Google Drive settings. Before you have connected your Google Drive account with X-CloudBackup, this section contains a message saying "You should connect your Google Drive account with X-CloudBackup. Please use this link."
    Storages settings1.png
  11. Follow the link. You will be redirected to Google.
  12. When prompted, provide permission for the created application ("Backup for my store" or whatever name you gave it) to view and manage the files and documents in your Google Drive (Click Accept). After this you will be redirected back to the X-CloudBackup page in your X-Cart store.

That is all - your Google Drive account is now connected to X-CloudBackup. The Google Drive settings section now shows your Google Drive account info:

Storages settings googledrive.png

Should you decide to stop using X-CloudBackup with Google Drive, you can revoke the connection at any time using the Revoke access button.

Running the script cron_backup.php

X-CloudBackup provides a script cron_backup.php that must be periodically executed from the command line for correct operation of the module. This script ensures launch of scheduled and on demand backups regardless of whether the browser is open. The recommended frequency for running cron_backup.php is once per 5-10 minutes. We recommend to launch this script using your favorite scheduling program (for example | cron daemon in Unix/Linux systems).

Recommended setup for running the cron_backup.php script via crontab:

*/5 * * * * cd /path/to/your/xcart; /path/to/php -d safe_mode=Off cron_backup.php --key=c901d65fc15ff15d0ac0af967437d051
  • */5 * * * * - to run the script every 5 minutes
  • cd /path/to/your/xcart - to change dir to X-Cart folder on your server
  • /path/to/php - path to PHP 5.3.1 CLI binary on your server
  • -d safe_mode=Off - to execute cron_backup.php script
  • --key=c901d65fc15ff15d0ac0af967437d051 - secure key defined in X-Cart's General Settings ("Secure key for launching the cron.php script")


Using the X-CloudBackup add-on module

After you have installed and configured the X-CloudBackup add-on module in your store, connected it with the storages where backups are to be uploaded and set up a scheduling program to periodically run cron_backup.php, all is ready for you to start using the module for backing up your store's data.

Important: Before choosing to run a manual backup or scheduling backups to be run automatically, please be sure to set up a scheduling program to periodically run the script cron_backup.php. X-CloudBackup will not be able to run any backups without it.

In your store's Admin area, go to the X-CloudBackup page (Tools->X-CloudBackup):

Manage cloud backup.png

At the top of this page, a button titled Backup now is provided; this button can be used to run a backup at any time.

Also, you can see three tabs: Storages settings, Last backup info and Backup files.

The Storages settings tab is where you set the frequency at which your store is to be backed up (Daily, Weekly) and the exact time and date when the following backup is to be run.

Note: Actual backup times depend on when the script cron_backup.php is run. For example, when you click Backup now, the backup process is not started immediately; the module simply writes to the database that the following backup must be run not according to the defined schedule, but at the earliest opportunity. Next time that cron runs cron_backup.php, a check is conducted to determine whether it is time for a previously scheduled backup or whether a backup has been demanded manually. If one of the conditions is true, the backup process is launched.

The Last backup info tab provides information about the last time your store's data was backed up:

Manage cloud backup2.png
Note: Messages like "Delete old files... Files were deleted: backup_xx_xx_xx_xx_xx.zip" in the screenshot above reflect the deletion of older backup files being removed to make room for new backup files as defined by the Maximum number of backups on storages setting.

The Backup files tab provides a list of available (currently stored) backup archive files:

Manage cloud backup3.png

If a backup file is removed from any of the storages, it is also removed from the list; this way you can find out what backup files are available and where at any moment just by looking at the contents of the Backup files tab.

How to patch a 3rd party skin after the installation of the X-CloudBackup module