vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   index.php duplicate SELECT hack (https://vborg.vbsupport.ru/showthread.php?t=3771)

10-08-2000 11:32 AM

I'm new hacker of vBulletin. So backup your index.php first:-)

(1) find:
Code:

$categorys=$DB_site->query("SELECT categoryid,title,displayorder FROM category WHERE displayorder<>0 ORDER BY displayorder");
under it add:
Code:

  $forummoderators=$DB_site->query("SELECT user.username,forumid FROM forumpermission,user WHERE user.usergroupid=forumpermission.usergroupid AND canadminedit=1");
  while ($moderator=$DB_site->fetch_array($forummoderators)) {
          $forum_idx=$moderator[forumid];
          $mod[$forum_idx][]=htmlspecialchars($moderator[username]);
  }

(2)find:
Code:

$forummoderators=$DB_site->query("SELECT user.username,user.usergroupid FROM forumpermission,user WHERE user.usergroupid=forumpermission.usergroupid AND canadminedit=1 AND forumid=$forumid");
          if ($moderator=$DB_site->fetch_array($forummoderators)) {
            $moderators=htmlspecialchars($moderator[username]);

            while ($moderator=$DB_site->fetch_array($forummoderators)) {
              $moderators.=", ".htmlspecialchars($moderator[username]);
            }
          } else {
            $moderators="?";
          }

REPLACE with:
Code:

          if ($mod[$forumid]){
                  $moderators=join(",",$mod[$forumid]);
          }else{
                  $moderators="?";
          }

I benchmark my board with ab -c 5 -n 30 (apache 1.32),Requests per second from 0.9x up to 5.12 ^_^

AGAIN please backup your index.php first,I'm not sure if it's bug free.

10-08-2000 12:18 PM

What's it do?
:D

10-08-2000 10:59 PM

it's a hack to speed the showforums section of index.php up.

in the original code,Select moderators from forumpermission ... where forumid=1,2,3... every forum.

I hack it by select all moderators once.

10-09-2000 01:17 PM

Ah, yes, that clears up alot ;)

10-09-2000 01:35 PM

If this works as advertised then it should actually speed up alot of forums as that query is a severe hit, especially if their is no indexes on the user table.


All times are GMT. The time now is 11:42 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00991 seconds
  • Memory Usage 1,715KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (4)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete