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 Forumhome Stats Cache Serialize hack v2.2 (https://vborg.vbsupport.ru/showthread.php?t=61420)

Majik? 04-24-2004 02:14 AM

I never noticed before, but a member had pointed out to me that the thread views are showing as "0". Since I never notcied this before, I'll have to have a look at the CRON script I made.. Maybe I missed somehting, unless it was always that way.

Just looked and I have the threadview stuff where it should be.. It's the only thing that's not showing properly apparently. I have both the following as it should be in the CRON script..
PHP Code:

// <!-- THREAD VIEWS -->
$getthreadviews=$DB_site->query_first("
SELECT SUM(views) AS tviews
FROM " 
TABLE_PREFIX "thread
"
); 

PHP Code:

$statscache['getthreadviews'] = intval ($getthreadviews[tviews]); 

And the following in "/index.php"..
PHP Code:

 $statscache['getthreadviews'] = vb_number_format($statscache['getthreadviews']); 


Boofo 04-24-2004 02:23 AM

You missed something. That's why I have an option in the settings instead of doing it via cron job. ;)

Majik? 04-24-2004 02:26 AM

Quote:

Originally Posted by Boofo
You missed something. That's why I have an option in the settings instead of doing it via cron job. ;)

I checke dand everything appears to be where it should be.. That and it's the only tihng not working.. Maybe t was like that before, I don't know becasue I never noticed. Am I missing something?

Boofo 04-24-2004 02:33 AM

It works fine for me and everyone else. You missed something in your script. Look at the install file and see what you forgot to add. ;)

Majik? 04-24-2004 02:42 AM

I just chekced in phpMyAdmin and actally that's correct which I don't get.. The SUM does return 0. But, If I look at the threadviews table, there are numerous rows (pages of them).. But, thread.views is set to 0 for all threads. Would I be able to do a COUNT on the threadviews table and get the same result?

I looked in the install file again and everything relating to thread views is where it should be (that I saw anyhow).

Boofo 04-24-2004 02:52 AM

If it is showing 0 for thread views in the table, then you have something else going on. As long as you have this query:

PHP Code:

    // <!-- TOTAL THREAD VIEWS -->
    
$getthreadviews=$DB_site->query_first("
            SELECT SUM(views) AS tviews
            FROM " 
TABLE_PREFIX "thread
        "
); 

and this code:

PHP Code:

$statscache['getthreadviews'] = intval ($getthreadviews[tviews]); 

and this variable in the forumhome template:

HTML Code:

$statscache[getthreadviews]
then it will return whatever the table has in it for thread views.

Try this: Take the cron job off for this and set it up like in the install file and let it run for a few minutes and see if they start showing up then. Make sure to set the cache update time to 0 to test it.

Majik? 04-24-2004 02:56 AM

Quote:

Originally Posted by Boofo
If it is showing 0 for thread views in the table, then you have something else going on. As long as you have this query:

PHP Code:

    // <!-- TOTAL THREAD VIEWS -->
    
$getthreadviews=$DB_site->query_first("
            SELECT SUM(views) AS tviews
            FROM " 
TABLE_PREFIX "thread
        "
); 

and this code:

PHP Code:

$statscache['getthreadviews'] = intval ($getthreadviews[tviews]); 

and this variable in the forumhome template:

HTML Code:

$statscache[getthreadviews]
then it will return whatever the table has in it for thread views.

Try this: Take the cron job off for this and set it up like in the install file and let it run for a few minutes and see if they start showing up then. Make sure to set the cache update time to 0 to test it.

Okay, but I don't know what difference that would make as I looked in the database directly and thread.views is set to "0" for all threads.. But, thread views are displaying in the forums as they should be. :S

I'd already changed it to do a COUNT on the threadviews table and now it's showing thread views as "2,827". I have thread views set to update hourly and noticed that the threadviews table's used for hourly updates instead of updating thread.views immediately upon viewing.
PHP Code:

// update views counter
if ($vboptions['threadviewslive'])
{
 
// doing it as they happen
 
$DB_site->shutdown_query("
  UPDATE " 
TABLE_PREFIX "thread
  SET views = views + 1
  WHERE threadid = " 
intval($threadinfo['threadid'])
 );
}
else
{
 
// or doing it once an hour
 
$DB_site->shutdown_query("
  INSERT INTO " 
TABLE_PREFIX "threadviews (threadid)
  VALUES (" 
intval($threadinfo['threadid']) . ')'
 
);


Will have to look at vB's CRON script and see why the thread.views isn't being updated.. But, the views are displaying i the forums htough. :S

Majik? 04-24-2004 03:27 AM

I had to add
PHP Code:

// ####################### SET PHP ENVIRONMENT ###########################
ignore_user_abort(1);
@
set_time_limit(0);
 
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS'1);
define('SESSION_BYPASS'1);
define('LOCATION_BYPASS'1);
define('THIS_SCRIPT''cron');
 
// ######################### REQUIRE BACK-END ############################
chdir('/path/to/forum/');
require_once(
'./global.php');
require_once(
'./includes/functions_cron.php');
 
// #######################################################################
// ######################## START MAIN SCRIPT ############################
// ####################################################################### 

to the top of the threadviews.php CRON script.. for some reason the other vB CRONs are running okay though.. It's strange because thread views were increasing, but were no where near as high as they are now that thread.views has been updated. It's now around 13,000.

It's the only cron that wasn' running properly for one reason or another, promotions, ban removal, etc. were all being done.

Boofo 04-24-2004 04:19 AM

See? that's what happens when you take a hack that wasn't meant to be run by cron job and try to do it that way. At least you got it working your way now. ;)

Majik? 04-24-2004 04:23 AM

Quote:

Originally Posted by Boofo
See? that's what happens when you take a hack that wasn't meant to be run by cron job and try to do it that way. At least you got it working your way now. ;)

Well, it wasn't a problem with your script.. It was with vB's default threadviews.php CRON script not running properly all the time. All the others were running except for that one and possibly he attachmentviews one (never checked).

I put them all into the real CRON though because it's better then running hrough a fake CRON. All is well now though. :D

Ian Emu-UK 04-25-2004 06:33 PM

Quote:

Originally Posted by dstruct2k
Boofo -- I hope you're gonna fix the code for Top Thread Starter and Top Poster percentages to work with numbers over 1000. :)


Hint: The $totalposts and $totalthreads variables are sent through vb_number_format() BEFORE your hack runs. Numbers over 999 show up in the variables as "1,000" and as we all know, PHP can't do this: 1,002 / 9,534

(I've fixed this on my own, if you want my code, I'll give you it :p)

I would also be interest if you'd like to share ;)

Boofo 04-25-2004 08:42 PM

Quote:

Originally Posted by Ian Emu-UK
I would also be interest if you'd like to share ;)

There will be an update in the next day or two that will fix that problem as well as add a couple more stats to this hack.

Ian Emu-UK 04-25-2004 11:36 PM

Excellent, thanks for that :)

Chris|vB 05-03-2004 11:56 PM

* clicks install

thanks

Pseudomizer 05-04-2004 12:14 AM

Quote:

Originally Posted by Boofo
There will be an update in the next day or two that will fix that problem as well as add a couple more stats to this hack.

Hey mate ? I have some questions for you.

What performance benefit does this hack bring to my portal site ? Any experiences yet ? I read one query less. Right ? :nervous:

Before i try to install this version, you just mentioned above that you will bring out a new version. The first thread was not updated since 7th of april. So i assume you had no time yet to finish the new version ? :tired:

Please tell me when you finish it and i go for it. I don't want to do things twice. ;-)

Cheers buddy,

Boofo 05-04-2004 12:35 AM

I'm not sure how I'm going to work this quite yet. Apparently there are sites out there that download the hacks here and put them up for download on their site without permission and I'm really getting sick of releasing hacks that end up that way. Some of them are in other countries where Jelsoft will have a hard time doing anything about.

Any new hacks or future upgrades I do to my hacks will probably only be available on my site. I can watch things a little closer that way.

Pseudomizer 05-04-2004 08:20 AM

Quote:

Originally Posted by Boofo
I'm not sure how I'm going to work this quite yet. Apparently there are sites out there that download the hacks here and put them up for download on their site without permission and I'm really getting sick of releasing hacks that end up that way. Some of them are in other countries where Jelsoft will have a hard time doing anything about.

Any new hacks or future upgrades I do to my hacks will probably only be available on my site. I can watch things a little closer that way.

I don't think that your own site will prevent them from spreading. You usergroup is small and fine but if you create one day THE perfect hack and everyone wants to have it, then your site will be overrun and you will have the same like.

Cheers,

Boofo 05-04-2004 10:28 AM

Quote:

Originally Posted by Pseudomizer
I don't think that your own site will prevent them from spreading. You usergroup is small and fine but if you create one day THE perfect hack and everyone wants to have it, then your site will be overrun and you will have the same like.

Cheers,

I doubt we have anything to worry about me either creating THE perfect hack or my site ever getting overrun with anyone wanting something like that. If that's the only way I can keep an eye on my hacks and keep them from getting put on warez sites or whatever, then I guess that's what I'm going to have to do. Don't worry, buddy, you have the access you need to get them. ;)

Pseudomizer 05-04-2004 10:37 AM

Quote:

Originally Posted by Boofo
I doubt we have anything to worry about me either creating THE perfect hack or my site ever getting overrun with anyone wanting something like that. If that's the only way I can keep an eye on my hacks and keep them from getting put on warez sites or whatever, then I guess that's what I'm going to have to do. Don't worry, buddy, you have the access you need to get them. ;)

Yeah. :smoke:

Cheers,

ChrisLM2001 05-04-2004 07:00 PM

Quote:

Originally Posted by hXc Radio
Thought you might like to see how I worked this into the nav.. Love the hack! good job!! ;)

Ah, man, ah, man, ah, man....just when you thought you had your design figured out! :)

This is a great mod for those who love stats. On the navbar, it's even sweeter!

Adding it to my list of "to do" projects.....

Chris

Pseudomizer 05-04-2004 09:01 PM

Hi Boofo,

i need a quick guidance in here. The field of "Most viewed Profile" is every time 0. Even if i go in my own profile with the IE and use another username with Opera and set the interval to update every 1 minute. Every time it is 0.

I searched this thread but no one had this problem before. :ermm:

Any ideas why ?

Cheers,

*clicked install even if it is installed only on the testboard yet*

Boofo 05-05-2004 01:53 AM

If you are view your own profile, it won't add views to it. I did that so someone couldn't rack up the profileviews on their own account by continually refreshing it. ;)

Try viewing someone else's profile a few times and it will show up (as long as you have the query added to the member.php, that is). ;)

Pseudomizer 05-05-2004 07:58 AM

Quote:

Originally Posted by Boofo
If you are view your own profile, it won't add views to it. I did that so someone couldn't rack up the profileviews on their own account by continually refreshing it. ;)

Try viewing someone else's profile a few times and it will show up (as long as you have the query added to the member.php, that is). ;)

Good job to prevent someone pushing up the number of views for their own profile. Now i tested with multiple users and it works.

I heading now for the install on the live board. Good job with this hack.

Cheers,

Astovidatu 05-05-2004 02:36 PM

Yea, nice job!
But i think theres an error: "Top Poster: Astovidatu (756 Posts = 142,93%)" <- hows taht possible?

Pseudomizer 05-05-2004 03:17 PM

Quote:

Originally Posted by Astovidatu
Yea, nice job!
But i think theres an error: "Top Poster: Astovidatu (756 Posts = 142,93%)" <- hows taht possible?

Perhaps you missed that part here

Just an idea.

Cheers,

Astovidatu 05-06-2004 07:39 AM

Quote:

Originally Posted by Pseudomizer
Perhaps you missed that part here

Just an idea.

Cheers,

Yep indeed, thanks. Dut now it looks like this:
Top Poster: Astovidatu (756 Posts = 0,14%)

Thats not possible either by a sum of 3000 Posts total.

Boofo 05-06-2004 07:49 AM

Quote:

Originally Posted by Astovidatu
Thanks, but now it looks like this:
Top Poster: Astovidatu (756 Posts = 142.93)
Top Thread Starter: Astovidatu (121 Threads = 23)

The same just without percentage sign.

My code:
Code:

        $statscache['newthreads'] = intval ($newestthreads[count]) ;
        $statscache['newposts'] = intval ($newestposts[count]);
        $statscache['newusers'] = intval ($newestusers[count]);
        $statscache['getthreadviews'] = intval ($getthreadviews[tviews]);
        $statscache['topposter'] = $topposter[username];
        $statscache['topposterid'] = intval ($topposter[userid]);
        $statscache['toppostercount'] = intval ($topposter[posts]);
        if($statscache['topposterpercent'] > 100)
{
$statscache['topposterpercent'] = vb_number_format(($topposter[posts] / ($totalthreads + $totalposts)) * 100 / 1000, 2 ) . '%';
}
else
{
$statscache['topposterpercent'] = vb_number_format(($topposter[posts] / ($totalthreads + $totalposts)) * 100, 2) . '%';
}
        $statscache['topstarter'] = $topstarter[postusername];
        $statscache['topstarterid'] = intval ($topstarter[postuserid]);
        $statscache['topstartercount'] = intval ($topstarter[count]);
if($statscache['topthreadspercent'] > 100)
{
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100 / 1000, 2 ) . '%';
}
else
{
$statscache['topthreadspercent'] = vb_number_format(($topstarter[count] / $totalthreads) * 100, 2) . '%';
}
        $statscache['getfileviewsun'] = $getfileviews[username];
        $statscache['getfileviewsid'] = intval ($getfileviews[userid]);
        $statscache['getfileviews'] = intval ($getfileviews[profileviews]);
        $statscache['ref2'] = $ref[username];
        $statscache['topreferrerid'] = intval ($ref[userid]);
        $statscache['ref'] = intval ($ref[referrals]);
        $statscache['toprepun'] = $toprep[username];
        $statscache['toprepid'] = intval ($toprep[userid]);
        $statscache['topreprep'] = intval ($toprep[reputation]);
        $statscache['lastupdate'] = intval (TIMENOW);

and I deleted the 2 if - else statements you told.

I have a fix for all of the percentages that I am working on getting into the install file now. You might want to click the install button so when update the hack in the next few days, that you will be notified.

ImportPassion 05-08-2004 09:42 PM

Little problem here

Most Viewed Profile: 007 (0 Views)

Oh, just noticed this too...
Last updated at 07:00 PM - December 31st, 1969

After first update.

Shouldn't this default to N/A or something?

Boofo 05-09-2004 07:39 AM

Quote:

Originally Posted by 7thgenCivic.Com
Little problem here

Most Viewed Profile: 007 (0 Views)

Oh, just noticed this too...
Last updated at 07:00 PM - December 31st, 1969

After first update.

Shouldn't this default to N/A or something?

You need to set the updatetime to 0 and run it a couple of times when you first install it. The profileviews will only update when you view someone's profile and NOT your own. I don't have it counting views when the person is looking at their own profile. Look at someone else's profile a couple of times and it will show up.

ImportPassion 05-09-2004 10:58 AM

ok, i will check it out. but that profile is not mine.

Boofo 05-09-2004 11:08 AM

Quote:

Originally Posted by 7thgenCivic.Com
ok, i will check it out. but that profile is not mine.

Did you run the query and add the code to the member.php?

Chriss74 05-09-2004 03:09 PM

Thanks for this hack!

I'd like to have this statistics on a separate site. This statistics-site should include further statistics:
- recent attachments
- Number of Active Users Today
- 5 most read threads
- 5 threads with most answers
- last 5 threads
- last 5 new members
- average data: posts per member, posts per forum, answers per thread, new posts per day, new members per day, xy % of all members posted at least 1 posting

I began to write something for my board (have a look at the attachment). But it doesn't use the cache. Therefore it would be nice, if somebody could make one hack with all features.

Greetings,
Chriss

Boofo 05-10-2004 12:54 AM

Quote:

Originally Posted by Chriss74
Thanks for this hack!

I'd like to have this statistics on a separate site. This statistics-site should include further statistics:
- recent attachments
- Number of Active Users Today
- 5 most read threads
- 5 threads with most answers
- last 5 threads
- last 5 new members
- average data: posts per member, posts per forum, answers per thread, new posts per day, new members per day, xy % of all members posted at least 1 posting

I began to write something for my board (have a look at the attachment). But it doesn't use the cache. Therefore it would be nice, if somebody could make one hack with all features.

Greetings,
Chriss

Don't forget to click the install button. ;)

Astovidatu 05-14-2004 09:26 AM

Nice Ideas Chriss74...
But what about the fix for the Percantage stat? Shouldnt that have priority to more Stats.

Boofo 05-14-2004 09:36 AM

Quote:

Originally Posted by Astovidatu
Nice Ideas Chriss74...
But what about the fix for the Percantage stat? Shouldnt that have priority to more Stats.

The percentages are fixed. I am redoing (completely re-writing) the install file now. I will notify those that have clicked the install button when I upload the new file. I need to test it first to make sure I have left nothing out, though. If anyone is interested in helping test this, contact me PM.

paratek 05-14-2004 03:50 PM

How do you add the Most Active User today?....i don't see it refered to in the code

Boofo 05-14-2004 03:56 PM

Quote:

Originally Posted by paratek
How do you add the Most Active User today?....i don't see it refered to in the code

That will be available in the coming update. That is from a hack by Kentaurus (who authoriuzed me to use it in the stats hack). If you're interested, you can help me test the update to make sure I didn't forget anything in it. ;)

paratek 05-14-2004 03:57 PM

Absolutely Boofo, let me know

Boofo 05-14-2004 04:03 PM

Quote:

Originally Posted by paratek
Absolutely Boofo, let me know

Head to the site and pm me there. ;)

Chriss74 05-15-2004 05:43 PM

Quote:

Originally Posted by Boofo
That will be available in the coming update. That is from a hack by Kentaurus (who authoriuzed me to use it in the stats hack). If you're interested, you can help me test the update to make sure I didn't forget anything in it. ;)

That's right. I used the hack from Kentaraus.

@Boofo: Will your new/enhanced version of your Stats hack be installed on a separate site or again at the index-page? I would prefer a separate page.

Greetings,
Chriss


All times are GMT. The time now is 12:09 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.01857 seconds
  • Memory Usage 1,883KB
  • 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
  • (1)bbcode_code_printable
  • (2)bbcode_html_printable
  • (9)bbcode_php_printable
  • (21)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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