vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Logged in users optimization (1.0.1) (https://vborg.vbsupport.ru/showthread.php?t=47078)

fury 12-27-2002 10:00 PM

Logged in users optimization (1.0.1)
 
Note to users who have installed Xenon's Optimizing Forumhome v2.0 located here need not install this hack. Furthermore, should you wish to install that hack later on after installing this one, you will need to either uninstall it, or forego the section instructing you to modify the logged in users code.

-------------

This simple hack modifies the Logged in users list on the forumhome, reducing queries by one. This is done by knocking off the extra query for guest counting and instead changing the way the while loop that is used for the logged in users list works.

In other words, less queries = win. :)

Versions of vBulletin: 2.2.x
Tested on: 2.2.9
Modifications: File only (no database or template modifications)

Example: http://www.otcentral.com/forum/index.php
Except for the showing of one less query on the query count, you can see that the result is truly unnoticeable. Logged in users operates the same exact way as it does before the hack is made.

Although there's not much that can go wrong with this hack, support will be provided in this thread and by email. Preferrably thread in case someone else runs across the same problem. :)

Update: 12/29/2002 - 0:11

Version 1.0.1 released - Counter was still counting duplicate sessions but not displaying them.

JulianD 12-28-2002 09:34 PM

nice hack. I'm going to test it on my local server :D

Xenon 12-28-2002 09:39 PM

looks nice, but i think it could be buggy, because you've thrown out the DISTINCT selection, which wasn't there without reason i think ;).

But we'll see, it's a beta, maybe everything works correct and the distinct was just a devs paranoia ;)

fury 12-28-2002 10:17 PM

DISTINCT is there to make sure no sessions get repeated in the logged in user list. I took that out because no matter how many guests would be there, it would only show up with the first. In its place I put a username token check to make sure the list doesn't already have the user in it.

NuclioN 12-29-2002 12:42 AM

The number of users online on the index is after this mod not the same as the detaild list when you look at the locations and ip. On the index there were 20 and on the detailed list 13! So it looks there is a problem.

fury 12-29-2002 02:48 AM

It seems to work fine on my board. Have you applied any other hacks that affect the logged in users part of your forumhome? Can I get a link to the board you installed it on?

fury 12-29-2002 03:13 AM

Nevermind. I see the problem. The check which prevents duplicate sessions from showing is put outside of the registered user counter. The file is fixed, if you already installed this hack here is the code to move:

PHP Code:

if (!substr_count($activeusers_bare,"|||".$username."|||")) { 

REPLACE it with this
PHP Code:

if (!substr_count($activeusers_bare,"|||".$loggedin['username']."|||")) { 

and Move this just BELOW this line:
PHP Code:

} else { 

and ABOVE this line:
PHP Code:

$numberregistered++; 


Dean C 12-29-2002 12:03 PM

Wow so we've found another way the vb dev's could reduce queries?

- miSt

fury 12-29-2002 12:22 PM

Not quite yet

It appears for some mods and admins the dupe sessions are still counted and displayed.

Edit: I know what I did wrong. Thank god this is only a beta hack, i would've been dead after the first bug :D

Find this text (note: it's not its own line, there is text after it)

PHP Code:

$activeusers_bare .= $username 

Change it to this:

PHP Code:

$activeusers_bare .= $loggedin['username'

Make sure there's still the . "|||"; after it.

Fixed the text file with the change, but didn't bother updating the version number. :D

fury 12-29-2002 12:26 PM

Surely the vB devs would've thought of this for vB3, I think Kier said vB3's index.php is down to 8 queries... That's not bad considering all the info on it (number of users browsing each forum, last post title, etc)


All times are GMT. The time now is 03:31 PM.

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.01028 seconds
  • Memory Usage 1,743KB
  • 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
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete