Pensamientos al azar acerca de vBSEO y www.bmwfaq.com
Plugin restrict search when server load is high
Posted 10-24-2007 at 09:43 AM by Danny Bembibre
This is a old plugin that i make in the earling times of vBulletin 3.5
This plugin allow to you disable searches when the load average reaches a defined level.
The plugin work with linux, freeBSD and unix servers not in WINDOWS.
Be sure that you allow access to /proc/loadavg in open_basedir in php.ini
INSTALL
Simply install as product and go to ACP->Restrict Search Config and put a load value.
SCREENSHOTS
This plugin allow to you disable searches when the load average reaches a defined level.
- Can exclude user groups of the search restriction
- Users with search restricted can use google integrated search (by the plugin)
PHP Code:
$Groupids = explode(',', $vbulletin->options['Allowed_Groups']);
if(is_member_of($vbulletin->userinfo, $Groupids))
{
$SearchAllowed = true;
}
//$SearchAllowed = is_member_of($vbulletin->userinfo, explode(',',$vbulletin->options['Allowed_Groups'])) ? true : false;
if (!$SearchAllowed)
{
if ($load = @file_get_contents("/proc/loadavg")) //standard linux style
$loadavg = explode(' ', $load);
elseif ($load=@exec('uptime')) //unix style
preg_match('/averages?: ([0-9.]+),[s]+([0-9.]+),[s]+([0-9.]+)/',$load, $loadavg);
elseif ($load = @`sysctl vm.loadavg|cut -d" " -f3-5`) //BSD style
$loadavg = explode(' ', $load);
if (trim($loadavg[0]) > $search_load)
{
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('Danny_Restrict') . '");');
}
}
Be sure that you allow access to /proc/loadavg in open_basedir in php.ini
INSTALL
Simply install as product and go to ACP->Restrict Search Config and put a load value.
SCREENSHOTS
Total Comments 2
Comments
| | Thank you for contribution! |
| Posted 10-25-2007 at 10:09 PM by Oleg Ignatiuk |
| | Muchas Gracias!! |
| Posted 12-07-2007 at 11:19 AM by ToniLloret |
Total Trackbacks 0
Trackbacks
Recent Blog Entries by Danny Bembibre
- [How To] Funciona el mod_rewrite ? (03-27-2008)
- Setup Sphinx search in vBulletin (11-16-2007)
- Forum Stats Signature Generator (11-15-2007)
- Source Compile PHP 5.2.4 for Plesk 8 (11-13-2007)
- Photos of my new house (11-07-2007)
