Page Index Toggle Pages: 1 [2] 
Topic Tools
Hot Topic (More than 10 Replies) Quick-Guide Upgrade procedure incorrect: data loss (Read 10,275 times)
Senior Member

Posts: 516
Quick-Guide Upgrade procedure incorrect: data loss
May 24th, 2009 at 10:23am
Post Tools
In trying to upgrade a YaBB 2.1 forum to 2.4, I noticed that the upgrade procedures listed in the Quick-Guide are incorrect, in that the way the code is implemented, one of the steps prevents the old settings from being properly migrated to the upgraded forum.

Specifically, for upgrading from v2.1, the Quick-Guide says:
1) Install a brand new v2.4
2) Run Setup
3) Set the new forum to Maintenance Mode
4) Copy various files (Boards, Members, Messages, Variables) from the old board to the new board.
5) Log in, go to Settings, and save it.
6) Rebuild notifications, membership, message list, etc.
7) Check all your settings and modify as desired.

Step 3 is what causes the problem... after running step 3, copying the settings from the old board doesn't matter because they'll be ignored.  If you swap steps 3 and 4 (do step 4 first), or if you skip step 3 entirely, it all works fine.

The reason for this is that setting Maintenance Mode (step 3) rewrites the new and sets the $settings_file_version = "YaBB 2.4" ... when that happens, the upgrade procedure isn't run anymore!  So, if the old files are copied (step 4) after setting Maintenance Mode (step 3), none of the old settings files will be read because the $settings_file_version has already been modified and the upgrade procedure gets skipped.

If you do step 4 first, the old settings files are in place before the version number is changed - the upgrade procedure gets run properly and all is well.

So... to make a long bug report short, the fix for this is EITHER:
1) Rewrite the Quick Guide to swap steps 3 and 4 (copy the old files BEFORE setting Maintenance Mode), or
2) Change Admin/ so that setting Maintenance Mode does not change anything in the file except for the maintenance_mode flag... in particular, ensure that $settings_file_version does not change.

#1 is a quick fix, but in principle not the right move because you want your new forum in Maintenance Mode before copying all those files over, to ensure that nobody can log in, make posts, etc. while you're halfway through the upgrade.

Thus, #2 is the more appropriate solution, because it ensures that the forum is in Maintenance Mode during the upgrade, and also it's correct "philosophically" since setting Maintenance Mode should do only that - set the maintenance flag, without modifying anything else.

(I can't tell you how many times I deleted and reinstalled my board before figuring this bug out.... it was really frustrating.)

OK, I've discovered more data loss:

My ban information (from Variables/ban.txt) gets lost even if I follow the procedure above, which otherwise works fine for everything else.

I don't know why this happens, because the upgrade procedure (in &SaveSettingsTo within Admin/ clearly does read Variables/ban.txt and appears to parse it just fine... but for whatever reason, that information never gets saved into the file.  The code looks fine on a cursory inspection, but since the end result is not the correct one, there's a bug somewhere in there.

Even worse, Variables/ban.txt gets deleted after the upgrade so even though the code to save the banned IPs/emails/usernames doesn't work, the code to delete the file does and the ban information is lost "forever" that way.  (Thankfully, I have a backup.)

So, the code in &SaveSettingsTo which reads and parses ban.txt should be examined, since there's data loss in there and I have no idea why.  (I'll try to step through the code more thoroughly when I get a chance, but I wanted to report this ASAP.)
« Last Edit: May 24th, 2009 at 12:00pm by Jet Li »  
Back to top
IP Logged
Page Index Toggle Pages: 1 [2] 
Topic Tools
  « Board Index ‹ Board  ^Top