EasyBackup

From e107 Wiki

Jump to: navigation, search

Contents

EasyBackup

a plugin by nlstart.

EasyBackup v1.7 is out since July 25, 2009.

(initial version published September 8, 2008)

EasyBackup is a simple plugin to send a daily backup of your e107 database to an e-mail address.

Purpose of the EasyBackup plugin

  • GOAL: Send a daily e107 MySQL backup to an e-mail address.
  • DISCLAIMER: EasyBackup only creates a back-up of the MySQL database. Restore has to be done manually with e.g. phpMyAdmin.

Latest version

version v1.7

Prerequisites

E107 core v0.7.7 (or newer) installed.

E107 Mail settings (Admin > Mail > Options)

In order to zip the files the PHP zip extension must be enabled.

Support

Download: EasyBackup download

Download mirror: EasyBackup download mirror on plugins@e107.org

Forum: EasyBackup forum

Bugs: EasyBackup bug reports

Requests: EasyBackup requests

Installation

  • a. Upload EasyBackup files into your 'e107_plugins' folder. Although 'Upload plugin' from the Admin section might work, uploading your files by using an FTP client program is recommended.
  • b. When working on Linux or Unix based server set the CHMOD settings of directories to 755 and set CHMOD of all .php files to 644.
  • c. Set the easybackup/bu folder so CHMOD setting 777 (this directory must be writable!)
  • d. Login as an administrator into e107, go to Plugin Manager, install EasyBackup
  • e. Go to Admin area > EasyBackup > Configuration and make sure a proper e-mail address where you want to send your backup files to is filled in.

Updates

There have been no database updates since v1.0!

Upgrading from version 1.3 and higher:

* go to Admin Area > Plugin Manager > Find EasyBackup and click on button 'upgrade'.

Upgrading from 1.2:

* The plugin will try to delete the easybackup_menu from the easybackup folder; if it fails you have to do it manually
* In Admin area > Menus> remove the easybackup from any active area

Alternatively you can completely delete the existing (1.2) easybackup folder from your plugins folder and install the plugin 1.7 as new.

Important background information

EasyBackup can help you making a daily back-up of your e107 database. EasyBackup does NOT backup your complete e107 website! Your total website also consist of images, uploads, downloads, theme(s), plugins etc. In order to replace your complete website within a short amount of time, you should create regular backups of those e107 elements too!

General Preferences are saved in the MySQL database in file 'e107_core' (file names my vary depending on your database preference), in field 'Siteprefs'. The fields are stored in an array (as all e107 preferences are in here) starting with 'easybackup_'.

The e-mail preferences must be filled in correctly before activating this plugin. You can find them at Admin area > Mail > Options. If you are able to send and receive the test e-mail from there, you should be ready to use the EasyBackup plugin.

It is important to test your configuration. Only the main administrator will be able to run the tests. Normally backups are created only once a day, except in the test mode.

It is possible to skip sending e-mails with setting 'Send e-mail' to 'Off'. This means that the backup(s) remain on your server.

NOTICE leaving backups on your server means a potential security risk. If somebody would guess your backup name you left behind it would be possible to download the complete MySQL database. Therefore it is recommended to use the setting to delete databases after e-mailing them.

In order to save disk space on your server it is advised to keep the setting 'Delete database after succesful e-mail?' to 'On'. Otherwise you will have to remove previous backups manually. You can use the admin menu 'Backup folder overview' to do so. Of course you can also directly access the easybackup/bu site with a FTP client program like e.g. FileZilla.

In order to help you delete previous backups the setting 'Delete previous backup file?' can be set to 'On'. It will automatically delete 'yesterdays back-up' so you will not have to do it manually. This will help you not running out of disk space.

To make things not overly complicated it is not advised to use the Visibility option in the menu for the easybackup menu. The setting 'EasyBackup trigger class' will already take care of the right triggering. Note however that any Visibility set in the Menu will prefer first and before the EasyBackup trigger class.

When having a large e107 website (e.g. with lots of users and giant forum activity), the backup size might be considerably big. Using the zip functionality might help a bit towards that. The zip functionality of EasyBackup will only be visible if the PHP zip enhancement is loaded and running. When working with big websites it might occur that even the zip is too big to be send by e-mail. In that case you have to download the backup file manually or set up a cron job to download/email/FTP it to somewhere else. You are advised to test the backup performance with the test mode at this type of websites regularly.


What is the EasyBackup trigger class about?

The given trigger class is the class that a user has to belong to before kicking off the backup.

So, if the trigger class is set to 'Member', the first user that visits the site as a logged in member will start the backup. If the trigger class is set to 'Everyone', the first visitor will start the backup.

If you set the trigger class to 'Main admin' it will only be the main administrator that will start the backup. If the main administrator does not visit the site for a week; no backup will be made for a week.

Especially for big websites the backup procedure might slow down the website experience of the 'victim' (read: the first visitor of the day that is entitled to create a backup). In that case you might want a certain user class (e.g. forum moderators that come daily to your website) to kick off the backup.

It just gives you a bit more control over who will kick off the backup. That's just it.

Troubleshooting

It is very important to have write rights in the easybackup/bu folder. The plugin tries to change the CHMOD settings to 777, but not all hosts have this option activated. So it might be this must be done manually. It is advised to set the CHMOD settings with a FTP client program, e.g. FileZilla.

If you have changed the Plugin code and/or directory structure(s) and/or (file)names and it does not work... Please uninstall and re-install it again. If the module is not working without modifications something else might be wrong.

Sometimes when programming your own modifications it might be handy to have some debug information. Once activated, you'll see SQL Traffic counters, SQL query analysis and PHP errors all at the bottom of your page. Here's how:

Activate debug option in Admin area > Preferences > Advanced Features > Developer Mode: On

Switch debug on with easybackup.php?[debug=all+]

Switch debug off with easybackup.php?[debug=all-]

De-activate debug option in Admin area > Preferences > Advanced Features > Developer Mode: Off

NOTE: developer mode should only switched to 'On' in a test environment!

WARNING: For large websites the back-up file as attachment to be send might become too large!

The EasyBackup plugin is capable of zipping the .sql back up file. This functionality will only become visible if the plugin detects that the PHP extension 'zip' is loaded. You can go to Admin Area > PHP info and see if the 'zip' extension is enabled on your host server.

If you want to use the ZIP functionality but it is not available on your host: please contact your host. If you run your own web server you need to follow these instructions to install the zip extension.

Error codes

Error code 1: The backup has already been created
Error code 2: Check file e107_backup_checkfile_YY-mm-dd cannot be created in easybackup/bu folder
Error code 3: Folder easybackup/bu is not writable; change the CHMOD to 777
Error code 4: Program can not connect to the MySQL database
Error code 5: Program can not open the specified database
Error code 6: Today's check file e107_backup_checkfile_YY-mm-dd can not be created in easybackup/bu folder
Error code 7: ZIP procedure can not create zip archive
Error code 8: E-mail can not be send

Changelog

Version 1.7

* general: some coding efficiency/consistency/readability improvements
* e_module.php: better check for test or live mode
* e_module.php: added preventing loops when site is for logged in members only

Version 1.6

* easybackup.php: somehow didn't pack the intended code for easybackup to solve parse errors

Version 1.5

* e_latest.php: new module to show latest backup date in admin latest menu
* English.php: adjusted EASYBACKUP_CONF_06 description
* English.php: added EASYBACKUP_LATEST_01 description for e_latest.php
* easybackup.php: fix to avoid zip parse error on some old PHP 4 hosts  (thanks to KVN/steved/Kroll for their input/test)
* easybackup.php: more efficient coding for updating tables in .sql file saves space; with same database: old file size: 344 kb, new: 249 kb.
* easybackup.php: check if backup has been created that day has been improved (line 99)
* e_module.php: sometimes backup procedure was triggered but didn't complete the backup; 
  EasyBackup will retry until a backup has been made succesfully that day.

Version 1.4

* easybackup.php: fixed bug to remove previous check file
* easybackup.php: introduced function to clean up all previous check files
* easybackup.php: made the hard coded donation phrase language independent
* English.php: added donation phrase
* plugin.php: more efficient coding for removing the redundant easyshop_menu.php

Version 1.3:

* easybackup.php: definitely fixed correct numbering of error codes (duplicate error code 6)
* changed easybackup_menu.php into e_module.php: selecting a menu is not necessary anymore 
  (old version easybackup_menu.php has become redundant)
* plugin.php: will try to delete redundant easybackup_menu.php

Version 1.2:

* easybackup_menu.php: introduced trigger date to properly previous checkfile in easybackup.php
* admin_config.php: show new variable trigger date and give admin possibility to overwrite it
* admin_config.php: introduced new variable 'Send e-mail' (default 'On') to be able to override the email process
* admin_config.php: introduced new variable 'Delete previous backup' to automatically remove previous backup; 
  especially handy when 'Delete backup' equals 'No'. With this setting manual deletion is not necessary; only the last backup will remain.
* admin_config.php: introduced new variable 'Create ZIP file mode' (default 'Off') to be able to zip the file
* easybackup.php: removed some die() moments to prevent unexpected exiting of program
* easybackup.php: fixed correct numbering of error codes
* easybackup.php: introduced zip procedure if setting is on and if detection of PHP zip module is true
* easybackup.php: will e-mail the .zip file if the backup if it is available, otherwise the .sql file

Version 1.1:

* removed redundant admin_upload.php from .zip file
* fixed irritating typo of EasyShop instead of EasyBackup in settings

Version 1.0:

  • Sub-goals for release 1.0:
    • make plugin fully e107 compliant
    • make plugin language independent
    • initial version

Future roadmap

  • actually monitor the buglist
  • monitor what features end users want

Technical aspects

Directory Structure

After a straight installation of EasyBackup the directory structure in the e107_plugins folder should be as follows:

 e107_plugins
     |- easybackup
             |- bu	     
             |- images
             |- languages

  • The images folder contains the images 'logo_16.png' and 'logo_32.png' which are called by plugin.php
  • The bu folder will contain a check file and your backup files if you do not delete them
  • The languages folder contains default language file English.php with all terms used by all modules of this plugin

Plugin Modules

The plugin consists of nine different files forming one integrated module. Each .php file contains a standard set of instructions to run properly under e107. The plugin files are heavily commented in order to show starting plugin developers why certain things are done.

admin_config.php

Task is to display and store the current plugin settings. A valid e-mail address is mandatory.

admin_overview.php

Task is to display all the files in the easybackup/bu folder and gives the admin user an option to view and/or manually delete files.

admin_menu.php

Task is to show the administator menu.

admin_readme.php

Task is to show the readme.txt from the menu.

help.php

Task is to display help text on the left side column of the administrator menu.

plugin.php

General set-up of e107 plugin to tell e107 Plugin Manager where files reside, which logo to use, etc.

readme.txt

Not really a module but called by admin_readme.php to display all relevant plugin background info, installation instructions etc.

easybackup.php

The main plugin; checks if user is allowed to start it; main admin is able to do the test mode; otherwise one backup file a day is created and e-mailed.

e_module.php

The module that triggers the program easybackup.php if there is no backup found earlier and if the user is allowed (based on the admin settings) to trigger the backup.

e_latest.php

The module that displays the latest backup date in admin latest menu.


NOTE the e_module.php replaced the former easybackup_menu.php. If the easybackup_menu.php is still present in your e107_plugins/easybackup folder after installing of upgrading it means the automatic attempts to delete it failed; you should remove it manually with e.g. cPanel File Manager or FTP client program.

Personal tools