Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 2.x > vBulletin 2.x Full Releases
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries Details »»
[Improvement] vBStats -> Member Referrer list PHP-code improvement (much less queries
Version: 1.00, by KuraFire KuraFire is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.2.x Rating:
Released: 01-12-2003 Last Update: Never Installs: 15
 
No support by the author.

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
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...

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 01-13-2003, 07:41 PM
Floris Floris is offline
 
Join Date: Jan 2002
Posts: 1,898
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice work, implemented it on my site and page loads faster, less less less queries and works with 2.2.9
Reply With Quote
  #3  
Old 01-13-2003, 07:43 PM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This works on any board where vBStats works

as long as you haven't brutally raped your vbstats.php code anyway
Reply With Quote
  #4  
Old 01-14-2003, 08:12 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

*goes post a notice in the vbstats thread* ^_^
Reply With Quote
  #5  
Old 01-14-2003, 03:42 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod

Did you ask bane for permission

- miSt
Reply With Quote
  #6  
Old 01-14-2003, 11:38 PM
Natch's Avatar
Natch Natch is offline
 
Join Date: Nov 2002
Location: Australia
Posts: 851
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

Reply With Quote
  #7  
Old 01-15-2003, 12:22 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Mist: pah! ;p

Natch: I agree ^_^
Reply With Quote
  #8  
Old 01-15-2003, 03:39 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

- miSt
Reply With Quote
  #9  
Old 01-17-2003, 02:51 AM
Bane's Avatar
Bane Bane is offline
 
Join Date: Oct 2001
Posts: 411
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well done Kura Should I get a chance to upgrade vbstats I will with your permission use this code. =) Very well done.
Reply With Quote
  #10  
Old 01-17-2003, 08:28 AM
KuraFire's Avatar
KuraFire KuraFire is offline
 
Join Date: Oct 2001
Location: inside vB3's .php
Posts: 1,245
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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)

Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:59 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04860 seconds
  • Memory Usage 2,295KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete