vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   vB3 Forum Quick Stats Cache Serialize Hack v1.1 (https://vborg.vbsupport.ru/showthread.php?t=61581)

Boofo 02-14-2004 10:00 PM

vB3 Forum Quick Stats Cache Serialize Hack v1.1
 
vB3 Forum Quick Stats Cache Serialize Hack
Version 1.1
(By Boofo)

What does this hack do?
It will display stats about each forum at the top of that forum. (NOTE: The attachments info will NOT show in forums that have no attachments.) Also included in the hack is Logician's vB2 "Last Post Minute Hack" (with his permission for the vB2 version, of course) optimized and redone for vB3. It now uses NO queries to get the last minute info. This hack will display a link the last post and the time the last post was made (i.e. "1 minute" or "2 days", etc.) as well as the name and link to the last poster in the forum. The stats are cached and the cache is only updated at a time set by you. With an option in the Admin CP, you can reset the time between cache updates without having to edit any more files once this hack is installed. This hack will add 1 optimized query (for the user's threads and replies stats) on a cache read, but since this hack is serialized, the cache read itself will not pull a query. On a cache update, it will add 6 queries to update the datastore. And then drop back down to the one query until the next cache update. This hack will make a cache in the datastore for each forum you have, so you don't have to worry about forums getting cross-cached with this hack. It has been thorughly tested on my site, but as we all know too well, sites can, and often do, vary in the way a hack performs on it. I forsee no problems of any kind on any site in the way this hack functions. It's basically pretty simple and hard to mess up. ;)

Note: This is the setting for the time interval (in minutes) that you want the cache to be updated on. The default value is 10 minutes. The following code is in the forumdisplay.php part of this hack.

$updatetime = 10;

Once you install the Admin CP setting (at the end of this file), you will be able to update this from the Admin CP vBulletin Options settings.

Credits:
A BIG thank you goes out to KirbyDE for all of his guidance and patience while this hack was being written and tested. This hack might never have gotten past the dreamed up state if it wasn't for him. And it definately wouldn't have been finished by now or turned out as optimized as it is. Thank you, my friend. I learned a lot from you on our little adventure here. It was definately worth the trip. ;)

Version Information:
Version 1.0
--Initial release
Version 1.1 --Corrected a few minor potential bugs and re-did the template. Now it has a cleaner look.

Installation overview:
Files to edit: (1)
--forumdisplay.php
Templates to add: (1)
--forumdisplay_quickstats
Templates to edit: (1)
--forumdisplay
Settings to add: (1)
--forumcachetime

Note: The first image below will show the forum quick stats for a forum that has attachments. The second image will show the forum quick stats for a forum that has no attachments.

Allan 02-15-2004 10:35 AM

Great Hack ;)

Allan 02-15-2004 11:27 AM

PHP Code:

Erreur

requ
?te SQL :  

INSERT INTO datastoretitle
DATA 
VALUES (

'forumstatscache''a:15:{ s:10:"numthreads";s:1:"0"; s:10:"numreplies";s:1:"0"; s:8:"numviews";s:1:"0"; s:15:"topthreadscount";s:1:"0"; s:12:"topthreadsid";s:1:"0"; s:12:"topthreadsun";s:0:""; s:17:"topthreadspercent";s:1:"0"; s:14:"toppostercount";s:1:"0"; s:11:"topposterid";s:1:"0"; s:11:"topposterun";s:0:""; s:16:"topposterpercent";s:1:"0"; s:12:"attachscount";s:1:"0"; s:12:"attachsbytes";s:1:"0"; s:9:"avgrating";s:1:"0"; s:10:"lastupdate";s:1:"0"; }'


MySQL a r?pondu:


#1146 - La table 'mysql.datastore' n'existe pas 


sabret00the 02-15-2004 11:36 AM

great work, this is like grogs version but for vb3 :)

Boofo 02-15-2004 11:40 AM

Quote:

Originally Posted by Socrate
PHP Code:

Erreur
 
requ
?te SQL 
 
INSERT INTO datastoretitle
DATA 
VALUES (
 
'forumstatscache''a:15:{ s:10:"numthreads";s:1:"0"; s:10:"numreplies";s:1:"0"; s:8:"numviews";s:1:"0"; s:15:"topthreadscount";s:1:"0"; s:12:"topthreadsid";s:1:"0"; s:12:"topthreadsun";s:0:""; s:17:"topthreadspercent";s:1:"0"; s:14:"toppostercount";s:1:"0"; s:11:"topposterid";s:1:"0"; s:11:"topposterun";s:0:""; s:16:"topposterpercent";s:1:"0"; s:12:"attachscount";s:1:"0"; s:12:"attachsbytes";s:1:"0"; s:9:"avgrating";s:1:"0"; s:10:"lastupdate";s:1:"0"; }'

 
MySQL a r?pondu:
 
 
#1146 - La table 'mysql.datastore' n'existe pas 


What version of vB3 are you running? This is tested and running on 3.0.0 RC3. That is saying you don't have datastore and if you are runing 3.0, you have to have it. ;)

EDIT: Are you using a table prefix?

Boofo 02-15-2004 11:42 AM

Quote:

Originally Posted by sabret00the
great work, this is like grogs version but for vb3 :)

This is the upgrade to my vB2 version. This is cached. Grog's isn't. I think this has more stats, too. And the percentages are accurate. ;)

Allan 02-15-2004 11:51 AM

I am on RC4

what I find odd, the table "datastore" is well and not, I do not employ the table prefixed

Boofo 02-15-2004 11:56 AM

It shouldn't be any different as far as datastore goes. You can install the hack without running that query and the datastore will get made. But I need to find out why you are having that problem with it. Try repairing and optimizing your db (in the Admin CP) and try the query again. Grab a new file from the first post. I just added table prefix to that just to be sure for everyone. Did you install my forumhome stats cache hack ok? That is the same type of datastore query there. Did it run ok?
Let me know what happens again. ;)

Allan 02-15-2004 12:03 PM

Quote:

Originally Posted by Boofo
It shouldn't be any different as far as datastore goes. You can install the hack without running that query and the datastore will get made. But I need to find out why you are having that problem with it. Try repairing and optimizing your db (in the Admin CP) and try the query again. Grab a new file from the first post. I just added table prefix to that just to be sure for everyone. Did you install my forumhome stats cache hack ok? That is the same type of datastore query there. Did it run ok?
Let me know what happens again. ;)

veiled, I optimized the table "datastore" in the admincp and Ca goes ok ;)

a last thing, to speak to you about this:
PHP Code:

$updatetime 10

could you indicate to me or to seek that, you do not specify it in the txt ?

Boofo 02-15-2004 12:05 PM

Ok, so it wasn't the hack messing up, right? Thank you. ;)

That is the update time in minutes for the cache. You set that to what you want. If you look at the end of the file, there is a setting you can do in the Admin CP so you can set it from the Admin CP after you install the hack. ;)


All times are GMT. The time now is 01:41 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.01397 seconds
  • Memory Usage 1,750KB
  • 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
  • (3)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)pagenav_pagelinkrel
  • (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