Your browser does not support iframes.
==Backing Up Your Forums For The First Time==
When using YaBB, it is very important to perform regular '''back ups''' of your forums, just in case something terrible happens to your data. This article outlines the first step in performing regular back ups.
===Why Should I Back Up My Forums?===
Because YaBB's '''database''' is based on '''flat-text files''', it is necessary to perform regular back ups of your forums, as a few minor server errors can begin wreaking havoc on your boards very quickly. In addition, with the popularity of YaBB increasing exponentially, hackers are bound and determined to find new security holes that they can use to wreck your forums and your site. Therefore, it is extremely important that you perform routine back ups of your forums.
===Performing The First Back Up===
When you first '''install''' or '''convert''' your YaBB forums, you should perform a full back up of your forums. Essentially, this simply requires you to download the entire ''yabb'' directory within your ''cgi-bin'', and the entire ''yabbfiles'' directory within ''public_html''. If you have moved your Messages, Members, Boards, etc. directories outside of your ''/cgi-bin/yabb/'' directory, you will need to download those as well.
===Which Files Do I Need To Back Up?===
For your first back up, especially if you have converted from an older version of YaBB, or some other forum software, you will want to be certain you download the entire contents of the following directories:
===How Do I Download These Files?===
In order to download these files, you will need to login to the FTP part of your server. You should use an '''FTP client''' to download these files. Simply log in to your server, just as you did to upload the files originally, and begin downloading all of the files onto your harddrive somewhere. You should make certain that you download the files in the correct format ('''ASCII/Binary''').
===How Often Should I Back Up My Boards?===
This really depends on how large and active your boards are. If you have forums that only get one or two new posts/members each week, then a weekly back up should be more than sufficient. If you have boards that get 30 to 40 new posts/members every hour, then you will want to do a back up significantly more often (possibly every hour). However, it is not necessary to perform a full back up every time you want to back up your boards. You can perform an '''incremental back up''' in most cases.
==Performing Incremental Back Ups==
No matter what size your forums are, you should perform routine, '''incremental back ups''', in order to prevent serious data loss. This article will detail which files you should back up on a routine basis.
===Backing Up Specific Files On A Regular Basis===
There are a few directories that should be backed up on a regular basis. The amount of time between incremental back ups really depends on the size and activity of your forums. However, no matter how active your forums are, you should routinely back up the following directories:
===Knowing Which Files To Download===
When performing an incremental back up, it is not necessary to download any directory in its entirety. You can actually save quite a bit of time by setting up your '''FTP client''' to download only new files, and only overwrite existing files if they have changed since your last back up. To find out how to set up your FTP client to do this, you will most likely need to consult the documentation that came with that software, as it varies greatly between clients. However, the concept behind the setting is the same in all clients that support this type of behaviour.
====Checking For Server Time Correction====
Before actually performing any incremental back ups, it is recommended that you go through a trial run first. Find a file on your server. Look at the date and time on that file (the "last modified" date). Download that file onto your harddrive, and see if that date and time changes. In many cases, the time will change by a few hours (forward or backward), which could cause you a lot of unnecessary headaches in the long run. In other cases, your FTP client will actually set the ''last modified'' timestamp to the date and time you download it onto your computer. Somewhere within your FTP client there should be a setting to correct this.
If the time does in fact change, you will need to consult the documentation for your FTP client to see if it supports '''server time correction'''.
Next, you should upload that same file back to your server (preferably in a new place). Check to make certain the time and date didn't change again.
===Setting Up An Incremental Back Up===
Once you have verified that the server time correction settings are correct, so that you won't overwrite your previous back ups unnecessarily, you can begin setting up your incremental back up. To do so, you will want to set up your FTP client to only overwrite existing files if the file in the destination directory has a modification date older than the remote file.
===Performing The Incremental Back Up===
Now that you have everything set up properly, you should FTP into your site and select the directories mentioned above. Then, choose to download them into the directory where you performed your last '''full back up'''. Your FTP client might ask if you want to perform a '''Smart Overwrite'''. If it does, then you should say "yes". Depending on your connection speed, and how active your forums have been since you performed your last back up, this may take a few seconds or it may take a few hours.
===Verifying That The Back Up Was Performed Properly===
Once the download is finished, you should take a look at the directories that you backed up, and verify that the new files were actually downloaded. In addition, you should verify that the files that have been modified since your last back up were actually updated. If not, you will need to take a look at your overwrite settings within your FTP client again.
===Knowing When To Perform A Full Back Up Instead Of Incremental===
There are certain times when a full back up should be performed instead of an incremental back up. There are other times when you will need to perform a back up somewhere in between the two. How do you know when to perform which back ups?
====Knowing When To Perform A Full Back Up====
Before you apply any mods to your forums, you should ZIP up your current back up directory on your harddrive and perform a new full back up. Once you have applied the mod, you should once again zip up that back up directory, and perform a second full back up. This will ensure that you can restore your forums from either back up very easily.
It is also a good idea to perform a full back up on a routine basis (once a month, once every six months). Before performing any full back up, it is a very good idea to ZIP up your older back up, and possibly burn it onto a CD, just in case you ever have the need to use it for anything.
===Knowing When To Perform A Semi-Full Back Up===
Before you make any changes to your forum (upgrading to a new version, adding a new template, changing images, adding new smilies, etc.) you should perform a full back up as described directly above. Once those changes are completed, you should perform a semi-full back up by backing up all of the files you would normally back up during an incremental back up, and backing up any files that you have changed/added.
===Knowing When To Perform An Incremental Back Up===
Obviously, you should perform an incremental back up on a routine basis, as discussed above. Any time a full back up or a semi-full back up is not recommended, you should be performing incremental back ups.
===Tips On Extra Back Up Comfort===
In order to make your back ups more effective, it is recommended that you actually perform two separate back ups of your forums, in two separate places on your harddrive. Then, when performing incremental back ups, you should alternate between updating each of those full back ups. This way, in case you perform an incremental back up after something on your forums has been corrupted, you will have a fall-back to restore your forums.
As mentioned above, you should also perform full back ups on a semi-regular basis.
==Restoring Your Forums After A Disaster==
This article outlines some of the steps you should take to restore your forums, in the event that something happens to corrupt or remove your data.
===Where Should I Start?===
Before concerning yourself with restoring files from a back up, you should begin by using the repair functions built in to YaBB. These features are outlined in the Admin Center section of the YaBB Codex. A quick list of these functions is:
* Recount Board Totals
* Rebuild Message Index
* Recount Membership
* Rebuild Members List
Be sure to try these functions before attempting to restore your forums from a back up. If they don't fix the problem, then you will need to restore from a back up.
===Restoring Your Boards From A Back Up===
Depending on what goes wrong with your boards, there are a few different ways to restore your boards from a back up.
====Restoring Members From A Back Up====
In the event that one of your members is accidentally deleted, or the member's data files become corrupt, you will want to locate that user's data files within your back up. They should be stored within ''/cgi-bin/yabb/Members''. All of your user's files should have filenames based on that member's username. Before doing anything with those files, however, you should check the ''/cgi-bin/yabb/Members'' directory on your server to figure out which files were corrupted or removed. If you find any files that are 0 bytes in size on your server, you will want to overwrite those files with the ones from your back up. If you find that there are files missing from your server, you will also want to restore those by uploading them from your back up.
From there, you should '''rebuild your memberlist''' from the Admin Center.
====Restoring Missing Messages====
If you notice that some of your messages have gone missing, you should begin by checking with your moderators, global mods and administrators to be certain they did not remove the message. You should also try to check with the user to make certain s/he did not remove their own message.
You should then check your ''/cgi-bin/yabb/Messages'' directory to make certain that the message really is missing. You will need to know the '''Message ID''', which should be a 10-digit number. Look for all files with that number as their filename. If there is a file called xxxxxxxxxx.txt (where the x's would be replaced by numbers) within that directory, and that file is not a 0 byte file, then you will want to try '''rebuilding your message index'''.
If you find that the post really did disappear mysteriously, you should be able to restore that message simply by uploading it from your back up into the ''/cgi-bin/yabb/Messages'' directory. You should upload all of the files with the appropriate message ID as their filename. Then you should try '''recounting your board totals''' and possibly rebuilding your message index.
====Restoring Missing Boards Or Categories====
Restoring a missing board or category can be a good bit trickier than restoring a missing message or member.
'''Very Important Note:''' Do not try to re-create the board or category from within your Admin Center. In most cases, the board or category does still exist on your server, but the catalog of that board/category has simply been corrupted. If you attempt to re-create the board or category from with your Admin Center, your old board/category files will be wiped out and overwritten.
=====Restoring Your Main Board/Category Catalog=====
FTP into your server and navigate to ''/cgi-bin/yabb/Boards''. Locate the following files:
You will want to download each of those files into a safe place on your harddrive, and open them in NotePad (or a similar plain text editor). Look through those files and search for any mention of the missing category or board. Most likely, you will find that the category or board has been removed somehow from one of these files. If this is the case, you should attempt to restore the board or category by simply uploading the forum.control or forum.master file from your back up.
=====Verifying That The Board Was Not Actually Removed=====
Once you have restored your forum.control and/or forum.master file, you will want to verify that the board was not actually deleted. To make sure, you will once again want to navigate to ''/cgi-bin/yabb/Boards'' and look for the '''board ID''' of your board. There might be multiple files with that ID as their filenames. For instance, if your board ID was gen_for, you may see the following files:
* gen_for.mail (this file will only exist if your users have requested notification on these boards)
* gen_for.txt (this file should exist for every board on your forums)
If the txt file is missing, or is 0 bytes, you will need to restore it from your back up. If that file does exist, and is not empty, then you should be able to restore the board simply by following the steps above.
$dir = "./yabb2";
$file = "$dir.tar.gz";
$file =~ s/.*\///;
$cmd = "tar -czf $file $dir";
print "content-type: text/plain\n\n";
print "Archiving $dir directory with tar to $file\n";
print "Archiving Complete";
$dir = "./yabb2";
$file = "$dir.tar.gz";
$file =~ s/.*\///;
$cmd = "tar -xzf $file";
print "content-type: text/plain\n\n";
print "Restoring $dir directory with tar from $file\n";
print "Restore Complete";