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)
-   -   [Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries (https://vborg.vbsupport.ru/showthread.php?t=47689)

KuraFire 01-12-2003 10:00 PM

[Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries
 
HACK: [Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries)
BY: KuraFire [www.kurafire.com]
DESCRIPTION: Instead of using 1 query for every member that has referred someone to your forum, this new code will use only 2 queries for it all, allowing you to set your Referrermax variable in the vB stats as high as you want, you'll not get 150 queries if you have 150 referring members or anything, anymore :)
DIFFICULTY: Easiest :D
INSTALL-TIME: 1 minute I'd say :)


extended description:
What the default vBStats Member referrer list bit does, is loop through all users who have referred a member to your board, and for each user it runs an additional query to select all the usernames of that user's referrerlist.

My code improvement eliminates that and simply uses 1 query for all the users in the left column (referrers), 1 query for all the users in the right column (referrals) and some PHP intelligence to get the same result. No more query-per-user. 2 queries are all that remains, and a bit of PHP looping (not much).

Now you can display your entire list without having to fear for the page needing God knows how many queries in total :)
(it had 52 queries on first guest view in the old default way when I'd not limit the amount of users it'd display, it has 12 now... :))


Instructions are in the attachment :)


Enjoy, vBStats users :)


Disclaimer: I spoke with Bane about this a long time ago and he was happy I was improving his code cos he didn't have the time for it. I doubt he'd mind me releasing it now that I've gotten around to doing it, but if he does, I'll take it down... :)

Floris 01-13-2003 07:41 PM

Nice work, implemented it on my site and page loads faster, less less less queries and works with 2.2.9 :)

KuraFire 01-13-2003 07:43 PM

This works on any board where vBStats works :)

as long as you haven't brutally raped your vbstats.php code anyway ;)

KuraFire 01-14-2003 08:12 AM

funny, so many people have vBStats yet hardly anyone has noticed this..

*goes post a notice in the vbstats thread* ^_^

Dean C 01-14-2003 03:42 PM

Nice mod :)

Did you ask bane for permission ;)

- miSt

Natch 01-14-2003 11:38 PM

Great work - no-one should really be fretting if their work is improved upon IMO ...

:D

KuraFire 01-15-2003 12:22 AM

Mist: pah! ;p

Natch: I agree ^_^

Dean C 01-15-2003 03:39 PM

Yes well i can't see why he would mind it's just always nice to ask these things to the respective creator :)

- miSt

Bane 01-17-2003 02:51 AM

Well done Kura :) Should I get a chance to upgrade vbstats I will with your permission use this code. =) Very well done.

KuraFire 01-17-2003 08:28 AM

Yay, Bane's approval ^_^
;)


Feel free to use this code in your new vBStats if you end up making that. I'm working on an alternative for vBStats, a stats system that doesn't do as much queries before a page even starts (like vBStats) and has a bunch of other features and is more flexible... (and, no offense, some cleaner code...)
oh, and my point was, I'll be using my own code in that new Stats hack for the referrerlist (though we will be using a different template-style for the display)

:)


All times are GMT. The time now is 05:57 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.01124 seconds
  • Memory Usage 1,728KB
  • 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
  • (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