After a slew of upgrades and massive internal reworking over at
Highend3d, Will and I decided to upgrade his Invision Power Board installation. Its been a few months since the latest Boards version 2.2 as well as
IPBSDK, so you’d think we were in the ‘safe zone’.
HECK NO! Ipbsdk threw a fit. After gathering a few horror stories, I think I have a good idea of how to fix it, involving 2, possibly 3, steps!
Our main file to edit..
ipbsdk/ipbsdk_class.inc.php
Step 1: New Bootstrap Method
Right before the inclusion of the main IPS file..
|
require_once ROOT_PATH . "sources/ipsclass.php"; |
Add this line
|
require_once ROOT_PATH . "init.php"; |
Step 2: Instantiation
Previously, the basic instantiation of the ipbsdk libs could be done multiple times, e.g.
1
2
3
4
5
6
7
8
9
10
11
|
require_once "ipbsdk/ipbsdk_class.inc.php";
global $SDK;
$SDK =& new IPBSDK();
$SDK->create_forum(....);
.... some code....
require_once "ipbsdk/ipbsdk_class.inc.php";
global $SDK;
$SDK =& new IPBSDK();
$SDK->write_pm(....); |
As of 2.2, the second instantiation of the
SDK classes will make the internal $SDK->DB object just disappear. So, don’t liberally sprinkle
$SDK =& new
IPBSDK;
commands all over the place.
If you see this error
|
Fatal error: Call to a member function on a non-object in /home/tm/domains/public_html/forum/sources/handlers/han_parse_bbcode.php on line 380 |
then you are suffering from the aforementioned problem. BBcode seems rather unrelated, but, its cache-check method is one of the first places that a missing DB adapter manifests itself, hence the ubiquity of that error message!
At this point, most people’s boards should work just fine!
Step 3 (Optional): Corrupt Group Data
We had some corrupt group/user data that would throw up IPS DB Driver errors as well. If you’re having issues, do a grep for ‘IN(’ in the class file.
if you see a statement like..
|
g_id IN(".$info['mgroup_others'].")"; |
change it, so that ’’ occupies the parenthesis in case there is missing group data, i.e. (IN () is not valid, at least IN(’’) is needed).
|
g_id IN(".(strlen($info['mgroup_others']) ? $info['mgroup_others'] : "''").")" |
I’m not a big fan of forum software in general. Its always big, bloated, ugly, and appeals to stats-whores of the worst kind (oh look, I have a shiny new counter for xxxx feature). Digging through forums for a fix like this drives me nuts! Hopefully, being in a blog makes this more easily accessible for those of us that enjoy blogs! Converge, oh IPB users, converge I say ;)