Journal Home Official Blog

12/26/2012 - Merry Christmas everybody!

Posted in Unspecified

Just a small note to wish you all a merry and blessed Christmas. I hope you have a great day with friends and family or even relaxing on your own.

If you are travelling, please have a safe journey and enjoy the trip.

I look forward to hearing all your holiday stories when you get back. Myself, I am spending the day with family and friends at home.

Share |
Technorati Tags: ,
Filed under: ,
0 CommentsPermanent Link
Share and enjoy
  • Digg
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb

3/4/2012 - How to moderate thousands of posts in vBulletin 3.x without timeout

Posted in PHP Code

I manage an old vBulletin (3.6.9) board and from time to time I need to moderate some posts/threads. One of the problems I have is, as the the only moderator, I sometime have 5000 or more posts/threads to moderate.

By default, vBulletin tries to display/moderate all the threads at once, this is ridiculous, even if your server can handle +5000 queries in one script your browser certainly cannot handle it, (you would need a truck load of memory to handle it).

So the best way is to edit the vBulletin code and limit the size of the posts been returned, that way you can moderate ~500 posts/threads at a time.

Look for the file called "moderate.php", it is found in the modcp folder.

Look for the code

  1. ...
  2. $moderated = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "moderation");
  3. ...

And add/replace the following limit checks to make sure it does not get out of hand.

  1. ...
  2. $moderated = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "moderation");
  3. while($moderate = $db->fetch_array($moderated))
  4. {
  5.  if($moderate['type'] == 'thread')
  6.  {
  7.   if(count($threadids) < 250)
  8.   {
  9.    $threadids[] = $moderate['threadid'];
  10.   }
  11.  }
  12.  else
  13.  {
  14.    if(count($threadids) < 500)
  15.    {
  16.      $postids[] = $moderate['postid'];
  17.    }
  18.   }
  19.   if(count($threadids) >= 500 && count($threadids) >= 250)
  20.   {
  21.     break;
  22.   }
  23. }
  24. ...

I know it would have been better to change the queries, (have 2 queries with type='thread' and limit of 250), but doing it this way makes it a little easier to explain.
Once you understand what is going on maybe you can change the code yourself to use more efficient queries.

The reason why I chose 250 threads and 500 posts? because, on my server, this seemed to be the safest way to prevent timeouts.

If you have version 4.x of vBulletin, I would be quite curious to hear how it works for you. I don't have that code, so I cannot say for sure if the same issue happens, (but I would hope that they fixed it).

Share |
6 CommentsPermanent Link
Share and enjoy
  • Digg
  • DZone
  • Netvouz
  • NewsVine
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • YahooMyWeb
<<Last PageNext Page>>

About Me has created this blog for the purpose of keeping members and visitors up to date with site information.
The easiest way to stay up to date is by using the RSS/XML feed.
Place this URL within your rss aggregator and it will automatically update itself whenever a new journal entry is published.

«  March 2017  »


View my profile
Email Me
My Wall
Webmaster Forum
Free Blog
Follow JournalHome on Twitter


Ant Onaf
Silver Wind