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)
-   -   Homepage Statistics Cache (https://vborg.vbsupport.ru/showthread.php?t=51163)

Snapperhaed 04-04-2003 03:17 AM

Tigga, #3 can be found at:
https://vborg.vbsupport.ru/showthrea...threadid=25755

Thanks!! I'll also peep to see what I may have altered. :D

Tigga 04-04-2003 03:53 AM

Well here's the first two for you. The 3rd looks like it would take a little more work so I'll have to post that for you tomorrow.

For members today and total thread views, first run this query via phpMyAdmin:

ALTER TABLE `statscache` ADD `threadviews` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;
ALTER TABLE `statscache` ADD `memberstoday` INT( 10 ) UNSIGNED DEFAULT '0' NOT NULL ;

Then open your index.php file (assuming you've already installed the hack) and look for:
PHP Code:

$getstats[posttoday]=number_format($getstats['posttoday']); 

Below that Add:
PHP Code:

$getstats[threadviews]=number_format($getstats['threadviews']);
$getstats[memberstoday]=number_format($getstats['memberstoday']); 

Then look for:
PHP Code:

$poststoday=$getpoststoday[count]; 

Below that Add:
PHP Code:

// members today
$getmemstoday=$DB_site->query_first("SELECT count(*) AS count FROM user WHERE joindate>='$datecut'");

// thread views
$getthreadviews=$DB_site->query_first("SELECT SUM(views) AS tviews FROM thread"); 

Then look for:
PHP Code:

posttoday='$poststoday'lastupdate='".time()."'"); 

Replace that with:
PHP Code:

posttoday='$poststoday'lastupdate='".time()."'threadviews='$getthreadviews[tviews]',memberstoday='$getmemstoday[count]'"); 

Then just add the variables $getstats[threadviews] and $getstats[memberstoday] in your forumhome template where you would like those to appear. (Remember it will take 10 minutes, or however long you set between updates, before those will appear.)

Snapperhaed 04-04-2003 04:01 AM

Thank You, Thank You, Thank You!!

Installed and worked perfectly. Many thanks for the assistance!
As a side note, I checked to make sure none of the original code was altered, before install, and it wasnt. But soon as I made the changes you provided, cured the problem right up!

Again, Thank you! Your the greatest. :p

Logician 04-04-2003 04:41 AM

caching such stats are always a good idea, especially in forum home, so very good job! :)

Tigga 04-04-2003 04:49 AM

Snapperhaed - No problem at all. I've added those stats to my forum page as well. :)
By the way, I noticed that you have mYvBindex installed on your site. You can use the same code there to pull the info and save 4 queries on your homepage (and add more stats) as well. ;)

Logician - Thank you. :D

mossyuk 04-04-2003 06:21 AM

1997 PMs?!?! Is that in total or just yours? Wow :)

Boofo 04-04-2003 11:33 AM

Ok, I got the other 2 figured out (finally). This is what I have left. Can anyone please tell me how to incorporate this, too?

Quote:

//Page Counter Code
$mycounter = $DB_site->query_first("SELECT count FROM mycounter");
$DB_site->query("UPDATE mycounter SET count = count + 1");
$mycounter = number_format($mycounter['count']);
//Page Counter Code

Kars10 04-04-2003 11:50 AM

Works like a charm and saves me about 5 Querys on Forumhome / and vBindex!!

Thanks
Kars

[high]* Kars10 kicks install! :)[/high]

Tigga 04-04-2003 04:23 PM

mossyuk - Yep, those are all mine. The board's been up for a little over a year and I rarely delete anything, so I guess they add up pretty quickly. :)

Boofo - I don't think that's something that should really be integrated with this... Since it's a page counter, updating it only every ten minutes wouldn't allow it to be accurate. It appears that it would only be 2 very small queries and a small table though, so it shouldn't affect performance much at all.

Kars10 - Glad you like it. :)

Boofo 04-04-2003 04:31 PM

You're right. I got to thinking about it after I wrote the message. I went from 31 queries down to 23 (and at 35 when the cache updates) and I have a couple of more stats than I had before. I did the Top Profile Views with this, too, if anyone is interested. ;)


All times are GMT. The time now is 03:29 PM.

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.01134 seconds
  • Memory Usage 1,748KB
  • 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
  • (6)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)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