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


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