Version: 1.00, by Tigga
Developer Last Online: Nov 2023
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.
Areku - If you'll refer to a post I made here, that should help you. It's for a different hack, but it should be enough to help you figure out how to change the commas to periods.
As for figuring out how many queries a page has, I would recommend installing Teck's Microstats hack. Alternatly you could open your admin/config.php file and put the code $debug="1"; right at the end of that file before the ?>. Then you would go to the url http://yoursite.com/forum/index.php?explain=1. At the bottom of that page it will show you the number of queries and the time it took to execute them.
Yea, actually I just realized what you did with the new posts since a users last visit. You should not have done that... Every time it updates the cache, it will display the number of new posts for that particular user, so all users will see the same number of new posts and threads. There's really not a way to cache those since they are specific for each member.
Well actually it should go by the time that is set on the server to determine when a new day starts. Then it should update that table every 10 minutes (assuming you didn't change the value), so within 10 minutes it *should* be correct. I'll work on changing it so that it will go by your forums timeoffset values as well though since that would make a little more sense.
Today at 04:37 PM Tiggasaid this in Post #37 Well actually it should go by the time that is set on the server to determine when a new day starts. Then it should update that table every 10 minutes (assuming you didn't change the value), so within 10 minutes it *should* be correct. I'll work on changing it so that it will go by your forums timeoffset values as well though since that would make a little more sense.
Bofo - Actually the only thing that would affect is where it shows an admin the last time the cache was updated. The $datecut variable is what would need to be modified.
I later realized you're right... server is on PST and I'm on GMT so it used server's time to update, presenting us "today registered users" when that was not true for our time zone