Enhancing 80 million pages.


Pensamientos al azar acerca de vBSEO y www.bmwfaq.com
Rate this Entry

Plugin restrict search when server load is high

Posted 10-24-2007 at 09:43 AM by dbembibre

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.
  • Can exclude user groups of the search restriction
  • Users with search restricted can use google integrated search (by the plugin)
The code
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') . '");');
      }
     } 
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

Attached Thumbnails
Click image for larger version

Name:	plugin1.jpg
Views:	81
Size:	43.7 KB
ID:	7   Click image for larger version

Name:	plugin2.jpg
Views:	89
Size:	52.4 KB
ID:	8   Click image for larger version

Name:	plugin3.jpg
Views:	100
Size:	120.8 KB
ID:	9  
Attached Files
File Type: xml product-RestrictSearchs.xml (8.2 KB, 206 views)
Posted in BMW FAQ Club, Php
Views 1245 Comments 2
Total Comments 2

Comments

  1. Old Comment
    Oleg Ignatiuk's Avatar
    Thank you for contribution!
    permalink
    Posted 10-25-2007 at 10:09 PM by Oleg Ignatiuk Oleg Ignatiuk is offline
  2. Old Comment
    Muchas Gracias!!
    permalink
    Posted 12-07-2007 at 11:19 AM by ToniLloret ToniLloret is offline
 
Total Trackbacks 0

Trackbacks


All times are GMT -4. The time now is 10:30 AM.


Powered by vBulletin Version 3.8.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 ©2009, Crawlability, Inc.