Make forum datadump

From FUDforum Wiki
Jump to: navigation, search

The Forum Backup admin control panel allows the administrator to generate a backup of all the forum data that is stored on disk and in the database. If PHP's gzip module is available the administrator may choose to compress the backed up data, to save drive space. This backup can later be restored to a forum running the same version of the forum.

Note: Responsible forum administrators will not only backup their forums regularly, but also perform test restores after making changes or upgrading to newer versions of the forum.

Important Symbol IMPORTANT: You cannot restore to a different version of the forum. You may want to save a copy of the install script with your backup files.

Contents

Configuration options

Backup Save Path

Enter the full path on disk where you wish to save the forum data dump or accept the default (forum's tmp directory).

Use Gzip Compression

Compress the backup file using Gzip compression. This will make the backup process a little slower, but will save a lot of harddrive space. The default is Yes.

Skip Search Index

Do not backup search related database tables. If you select this option you will have to rebuild your search index after importing the dump. This will make the backup much smaller and quicker, especially on large forums.

Common tasks

Besides using the provided Admin Control Panel, users may also need to run backups from command line and schedule them via cron or other system schedulers.

Command line backups

To run a command like backup, you need to be in the forum's adm directory:

cd .../forum/adm

Run admdump.php with PHP's command line interpreter to see usage info:

/usr/bin/php ./admdump.php
Usage: php admdump.php /path/to/dump_file [compress]
 - 'compress' is optional; specify only if you want to compress the dump_file.

OK, let's run it by specifying the dump_file as the first argument:

/usr/bin/php ./admdump.php /tmp/forum.fud

Schedule via cron

Here is a crontab like that can be used for automated forum backups:

# Weekly forum backups
0 1 * * 6 (cd /var/www/adm/; /usr/bin/php ./admdump.php /tmp/backup.fud compress) >/tmp/backup.log 2>&1

Authentication via HTTP

The backup script supports authentication via HTTP. The example below demonstrates how to take scheduled forum backups using this technique:

Example of an automated Forum Backup Script:

echo -e 'submitted=1\n&compress=1\n&path=/home/user/forum/backup/FUDforum_'`date +%Y%m%d`'.gz' | lynx http://YOUR_FORUM_URL/adm/admdump.php?do_http_auth=1 -auth=ADMIN_LOGIN:ADMIN_PASS -post_data

The parameters that are piped to the lynx utility represent the POST data. There are 2 arguments that you can change.

  • path This represents the full path on your harddrive where the backup file will be written to.
It is imperative that the user and/or group web-server runs as, has write access to that directory.
  • compress whether or not to compress the backup.
By default this option is set to 1, meaning that the archive will be compressed using zlib. If you wish to disable compression, change the value of this option to 0.

The other two options are ADMIN_LOGIN, ADMIN_PASS, which represent the login and password of the admin account. Since this is sensitive information, I highly recommend that you ensure other users on the server cannot read this file. For example, if you placed your backup code inside the shell script that would be executed by cron, make the shell script's permissions 500, thus only allowing the root user and yourself to read and execute it.

Needless to say, the YOUR_FORUM_URL should be replaced with your forum's URL.

Also see

Languages
Personal tools