PDA

View Full Version : Disable certain forums under heavy load?


Kevlar
05-26-2005, 11:54 PM
I saw a hack out there that allows you to disable the search feature under heavy load (user defineable)... so I'd imagine this would be possible with similar code. Would it be possible to disable certain forums (not all of 'em) under a user defined load? For example... we have our forums set to a *nix load of 10 for the entire board.

However, I would like to say set a *nix limit of 5 for the "off-topic/chitchat" board. Anybody have any ideas?

Andreas
05-27-2005, 12:32 AM
Cheepo-Solution:

Place this in Template phpinclude_start

$filestuff = @file_get_contents('/proc/loadavg');
$loadavg = @explode(' ', $filestuff);
if (trim($loadavg[0]) > 5) {
$bbuserinfo['forumpermissions'][ID] = 0;
}


ID must be replaced with the ID of your "chitchat"-forum.

Kevlar
05-27-2005, 01:50 AM
Not to be picky... but would there anyway to send them to the "server is busy page" instead of the user is denied page?

I can just see it now, I'd be getting hundreds of PMs asking why they were denied from the chitchat forum.

Andreas
05-27-2005, 02:07 AM
$filestuff = @file_get_contents('/proc/loadavg');
$loadavg = @explode(' ', $filestuff);
if (trim($loadavg[0]) > 5) {
$bbuserinfo['forumpermissions'][ID] = 0;
define('SERVER_OVERLOADED', 'yes');
}


Then in Template STANDARD_ERROR

<if condition="SERVER_OVERLOADED == 'yes'">
Your Overloaded, Sorry, Visit later Text here
<else />
Prior Content of STANDARD_ERROR here
</if>

Kevlar
05-27-2005, 12:20 PM
Excellent, I will give this a try...