Name: Advanced DB Backup

Version: 1.2

Last modified: 08/03/2009 @ 00:00 (GMT)

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.8 SP3

Tested On: XMB 1.9.8 SP3

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

Updated for 1.9.8 by: WormHole @ XMB Garage

Modification 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 & databases.

Affected Files (2): include/admin.inc.php, lang/English.lang.php

Affected Templates (0): NONE

====================================================================================================
=======
Step 1:
=======
==================


Edit File: admin.inc.php
==================
==========
Find Code:
==========

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

================
Replace Code With:
================

    </td>
    <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:
=======
====================
Edit File: English.lang.php
====================
============================
Add Code To End Of File Before ?>
============================

// Advanced DB Backup Mod Begin
$lang['db_backup'] = "Database Backup";
// Advanced DB Backup Mod End

====================================================================================================
=======
Step3:
=======

Create new directory ('db_backups') via FTP (ROOT directory is ideal and may need chmoding to 777 depending on server)

====================================================================================================
=======
Step 4:
=======
=========================================
Edit File: backupcp.php' (Included in the Contents folder)
=========================================
==========
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 5:
=======

Upload 'backupcp.php' to your forum directory.

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

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

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

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 8:
=======

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!