============================================================================================================================
Modification Name: Advanced DB Backup

Version: 1.2

Last modified: 03/29/2010

Description: This modification will enable you to create database backups of your forum.
                   The backups will be stored within a directory on your server.
                   The backups can be sent to a remote FTP server and / or an e-mail address.
                   The backups can be created automatically by using a cron job.
                   You can enter the duration to keep backups on the local / ftp server(s).

Compatibility: XMB 1.9.5 SP1

Code Developed By: Adam Clarke (http://www.xmbservices.com)

MOD History: V1.0 (12/11/2005 @ 18:20) - Initial Release.
             V1.1 (19/11/2005 @ 09:50) - Repaired restore feature.
             V1.2 (20/11/2005 @ 18:55) - Updated code to fix undifined offset.

License Note: This modification is released under the GPL License. A copy is provided with this software package.

Note: Backup all affected files, templates & database's.

Affected Files (1): include/admin.user.inc.php

Affected Templates (0): NONE
============================================================================================================================
=======
Step 1:
=======
======================
Edit File: admin.user.inc.php
======================
==========
Find Code:
==========

    &raquo;&nbsp;<a href="tools.php?action=whosonlinedump"><?php echo $lang['cpwodump']?></a><br />

===============
Add Code Above:
===============

    <!-- Advanced DB Backup Mod Begin -->
    &raquo;&nbsp;<a href="backupcp.php"><?php echo $lang['db_backup']?></a><br />
    <!-- Advanced DB Backup Mod End -->

============================================================================================================================
=======
Step 2:
=======

Create New Directory Via FTP 'db_backups' (ROOT directory is ideal and may need chmoding to 777 depending on server).

============================================================================================================================
=======
Step 3:
=======
==========================
Edit File: backupcp.php (Included)
==========================
==========
Find Code:
==========

// User editable settings.

// Database Info

  $config['db_username'] = ''; // Enter the username for the db(s) here. You do not have to use the same user as the forum.
  $config['db_password'] = ''; // Enter the password for the username above here
  $config['db_name'] = ''; // Enter the database name here.

// Backup Info

  $config['backup_compression'] = 'bzip2'; // ('none', 'gzip', 'bzip2')
  $config['backup_location'] = ''; // Enter backup storage path here (eg: '/home/user/db_backups/')
  
// FTP Info

  $config['use_ftp'] = '0'; // ('0' = No, '1' = Yes)
  $config['ftp_server'] = ''; // Enter the ftp address for remote transfer here.
  $config['ftp_username'] = ''; // Enter the ftp username for remote transfer here.
  $config['ftp_password'] = ''; // Enter the ftp password for remote transfer here.
  $config['ftp_path'] = ''; // Enter FTP path here (eg: 'public_html/')
  $config['ftp_passive'] = '0'; // Use passive FTP? ('0' = No, '1' = Yes)

// E-mail Info

  $config['use_email'] = '0'; // ('0' = No, '1' = Yes)
  $config['email_address'] = ''; // Enter e-mail address here.

// Auto Delete Info

  $config['local_delete'] = '7'; // Enter number of days to keep local backup's. ('0' = No Delete)
  $config['ftp_delete'] = '7'; // Enter number of days to keep remote backup's. ('0' = No Delete)

=====================================
Enter the values between ' & ' for your own server.
=====================================
============================================================================================================================
=======
Step 4:
=======

Upload 'backupcp.php' to your forum directory.

============================================================================================================================
=======
Step 5:
=======

Upload 'delete_backup.gif' image to all your theme folders.

============================================================================================================================
=======
Step 6:
=======

Navigate to backupcp.php and create a backup.

If the backup was not created or you receive permission errors, you will need to chmod the local storage directory to 777.

============================================================================================================================
=======
Step 7:
=======

If you want automatic backups you will need to create a cron job via cPanel.

Command Code: (Must have full path to forum directory and #DBNAME# is the name of the DB you wish to backup)
----------------------------------------------------------------------------------------------------
php -q /path/to/forum/backupcp.php #DBNAME# > /dev/null
----------------------------------------------------------------------------------------------------
============================================================================================================================
Enjoy!