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
Homepage Statistics Cache Details »»
Homepage Statistics Cache
Version: 1.00, by Tigga Tigga is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

Version: 2.3.x Rating:
Released: 04-03-2003 Last Update: Never Installs: 31
 
No support by the author.

A little while ago I ran into this problem... I like having a lot of statistics on my forum's homepage, but I don't like having a lot of queries on that page. That got me to start thinking of a better way to do it, hence the creation of this hack.

How does this hack work?
It's pretty simple really. Instead of counting every single thread, post, member and etc every time someone loads your forum, it only counts these after a specified amount of time and updates one table that the information will be pulled from. This hack is especially useful for high traffic sites and can reduce the time it takes to load your forum's homepage.

Statistics Included:
Total Threads
Threads Today
Total Posts
Posts Today
Total Members
Newest Member
Top Poster
Top Thread Starter
If you are an admin, it will show you the last time the stats were updated as well.

(Please note that some of these started as hacks from other members at vB.org. Most of them are so simple though I don't see much of a point in trying to figure out which one's I got from here X months ago. If your hack was included here and you would like credit given please post here and I will add it.)

Normally these stats would add 8 queries to your forum's homepage. With this hack installed it will only perform 1 query most of the time, and 9 queries when it needs to update the information. I have found this very useful to cut down on the number of queries on my homepage, decrease the page's loading time, and put less overall stress on my server.

Well that's about it. I hope some others will find this hack useful and if anyone has some suggestions for other stats they would like to include in the stats cache please let me know and I will try to implement them.

Show Your Support

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

Comments
  #2  
Old 04-03-2003, 10:56 PM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

There's not much to it, but here's a screen shot as well.
Reply With Quote
  #3  
Old 04-04-2003, 01:08 AM
Lethal Lethal is offline
 
Join Date: Feb 2002
Location: PA/USA
Posts: 164
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

looks nice, ill try this out ty
Reply With Quote
  #4  
Old 04-04-2003, 02:04 AM
SgtSling SgtSling is offline
 
Join Date: Oct 2001
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this also makes my last post on forum home hack update every ten mins along with the rest of the stuff you included above.
Is there anyway I can change this?
Reply With Quote
  #5  
Old 04-04-2003, 02:05 AM
SgtSling SgtSling is offline
 
Join Date: Oct 2001
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

clicksm install
Reply With Quote
  #6  
Old 04-04-2003, 02:18 AM
SgtSling SgtSling is offline
 
Join Date: Oct 2001
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

nevermind.. my fault
It saves 8 queries per load for me
Reply With Quote
  #7  
Old 04-04-2003, 02:26 AM
SgtSling SgtSling is offline
 
Join Date: Oct 2001
Posts: 156
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

How can we also cache the moderatorlist ?
XENON has a hack for this.. but it isn't compatable with this hack
https://vborg.vbsupport.ru/showthrea...=&pagenumber=1
Reply With Quote
  #8  
Old 04-04-2003, 03:02 AM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for pointing that out SgSling. I had forgotten about his modifications (I have Xenon's hack installed too). He saves another query by counting the posts in the thread query, so to use that with this hack you would just replace this (in the hack itself, or index page if you've already modified it):
PHP Code:
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');

// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']); 
With:
PHP Code:
// get total posts
$counters=$DB_site->query_first('SELECT SUM(replycount) AS posts, SUM(threadcount) AS threads FROM forum WHERE parentid=-1');
$countposts[posts]=$counters['posts'];
$countthreads[threads]=$counters['threads']; 
That should be the only conflict with the 2 hacks, and changing that saves yet another query when it updates the cache.
Reply With Quote
  #9  
Old 04-04-2003, 03:08 AM
Snapperhaed Snapperhaed is offline
 
Join Date: Mar 2003
Location: Argentina
Posts: 32
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Lets say I wanted to add a few more items to be cached ...

1 - Total Thread Views
2 - New Members Today
3 - Most popular thread by # of Replies

These 3 items I have installed, but they dont show now since I added this hack. (A nice one might I add).

I know (or i think rather) I need to add them into the table via a query, then adjust accordingly on the forumhome template ... But since im new to it, (i already ran the intial query), how can I add to the exist newly created table? (IE: add this to the statscache table) ...

Any/All help appreciated!!
Reply With Quote
  #10  
Old 04-04-2003, 03:13 AM
Tigga's Avatar
Tigga Tigga is offline
 
Join Date: Dec 2001
Location: Atlanta
Posts: 1,061
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Snapperhaed - The first 2 wouldn't be hard to add at all. If you'll give me a link to the 3rd one you're talking about I'll have a look at it to see what would need to be done to add it as well.
Oh, and those things should still work fine without the stats cache as long as you didn't modify any of the code that was for those hacks...
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 02:49 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.06704 seconds
  • Memory Usage 2,297KB
  • 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
  • (2)bbcode_php
  • (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