Back to vBulletin 3.0 Add-Ons

Restrict search when the server load is high
Mod Version: 1.00, by UK Jimbo

This modification is in the archives.
vB Version: 3.0.6 Rating: (0 vote - 0 average) Installs: 5
Released: 17 Feb 2005 Last Update: Never Downloads: 1
Not Supported  

From experience searches on large forums can slow the server down a lot.

Here's a dead simple hack that lets you disable searches when the load average reaches a defined level. Moderators are exempt from the search ban.

There's are just two changes to be made:

in search.php find:
PHP Code:
if (!$vboptions['enablesearches'])
{
        eval(
print_standard_error('error_searchdisabled'));

add below it:
PHP Code:
// automatically block search requests when the server is busy
$search_load_trigger=5;
if ( (!(
$permissions['adminpermissions'] & ISMODERATOR)) AND PHP_OS == 'Linux' AND @file_exists('/proc/loadavg') AND $filestuff = @file_get_contents('/proc/loadavg'))
{
        
$loadavg explode(' '$filestuff);
        if (
trim($loadavg[0]) > $search_load_trigger)
        {
                eval(
print_standard_error('error_searchdisabled'));
        }

The trigger level is based on the current (1 minute) load average. It can be changed by editing the $search_load_trigger variable.

You may also wish to change the searchdisabled phrase to something like:

Searching has been disabled. This is most likely automatic and due to high server load. Please try again later.

Download

No files for download.

Similar Mods

Restrict search when the server load is high vBulletin 3.5 Add-ons
Close Search during high server load vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024