Marco
09-19-2008, 10:29 PM
Through a custom script (which runs outside of vBulletin), I am adding IP addresses to the vBulletin ban list. First I add it to the setting table, like so:
$banlist = mysql_fetch_array(mysql_query("SELECT value FROM setting WHERE varname = 'banip'"));
$addban = $banip . " " . $banlist['value'];
$updatebanlist = mysql_query("UPDATE setting SET value = '$addban' WHERE varname = 'banip'");
($banip is the IP address I am adding)
Because vBulletin also saves a cached copy of the options in the datastore table, I then refresh the options in the datastore like so:
$q = mysql_query("
SELECT varname,value
FROM setting"
);
while ($setting = mysql_fetch_array($q))
{
$newsetting[$setting['varname']] = $setting['value'];
}
$new_ds = serialize($newsetting);
mysql_query("
UPDATE datastore
SET data = '$new_ds'
WHERE title = 'options'
");
Up until recently (I have no idea what broke it), this was working great. Actually it still works; when I add an IP address, it gets added to the setting table, I can see it in the Admin CP - User Banning options and I can see through phpMyAdmin that it gets added to the datastore too. However, the IP ban still isn't effective until I manually save the User Banning options in the Admin CP.
This is driving me nuts and majorly pissing me off by now. Can anyone see what's wrong? I mean, the correct information is in the database, in both places ('setting' and 'datastore') yet vBulletin (3.7.3) doesn't seem to care. Is there maybe another place this information is cached?
(And no, I cannot use the build_options() function from vB, since I'm running a standalone script.)
$banlist = mysql_fetch_array(mysql_query("SELECT value FROM setting WHERE varname = 'banip'"));
$addban = $banip . " " . $banlist['value'];
$updatebanlist = mysql_query("UPDATE setting SET value = '$addban' WHERE varname = 'banip'");
($banip is the IP address I am adding)
Because vBulletin also saves a cached copy of the options in the datastore table, I then refresh the options in the datastore like so:
$q = mysql_query("
SELECT varname,value
FROM setting"
);
while ($setting = mysql_fetch_array($q))
{
$newsetting[$setting['varname']] = $setting['value'];
}
$new_ds = serialize($newsetting);
mysql_query("
UPDATE datastore
SET data = '$new_ds'
WHERE title = 'options'
");
Up until recently (I have no idea what broke it), this was working great. Actually it still works; when I add an IP address, it gets added to the setting table, I can see it in the Admin CP - User Banning options and I can see through phpMyAdmin that it gets added to the datastore too. However, the IP ban still isn't effective until I manually save the User Banning options in the Admin CP.
This is driving me nuts and majorly pissing me off by now. Can anyone see what's wrong? I mean, the correct information is in the database, in both places ('setting' and 'datastore') yet vBulletin (3.7.3) doesn't seem to care. Is there maybe another place this information is cached?
(And no, I cannot use the build_options() function from vB, since I'm running a standalone script.)