Name: Advanced DB Backup

Version: 1.0

Last modified: 03/22/2009

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.11

Tested On: XMB 1.9.11

Code Developed By: Adam Clarke (http://www.xmbservices.com)
Code Updated By: John Briggs (http://www.xmbgarage.com)

modification History: V1.0 (03/22/2009) - Initial Release.

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

Note: Backup all affected files, templates & databases.

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

Affected Templates (0): NONE




====================================================================================================
STEP 1: Edit File 'admin.inc.php'

Find Code:
----------------------------------------------------------------------------------------------------

    <td class="tablerow" align="left" valign="top" width="20%" bgcolor="<?php echo $THEME['altbg2']?>">
    </td>
    
----------------------------------------------------------------------------------------------------

Replace Code With:
----------------------------------------------------------------------------------------------------

    <td class="tablerow" align="left" valign="top" width="20%" bgcolor="<?php echo $THEME['altbg2']?>">
    <!-- Advanced DB Backup Mod Begin -->
    &raquo;&nbsp;<a href="backupcp.php"><?php echo $lang['db_backup']?></a><br />
    <!-- Advanced DB Backup Mod End -->
    </td>
    
----------------------------------------------------------------------------------------------------
====================================================================================================




====================================================================================================
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: Navigate to backupcp.php and create a backup.

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




====================================================================================================
STEP 6: 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

----------------------------------------------------------------------------------------------------
====================================================================================================