vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Forum Home Enhancements - Site Life Status (https://vborg.vbsupport.ru/showthread.php?t=174416)

Andreas 05-18-2008 11:10 AM

PHP Code:

if ($vbulletin->options['site_lifestatus_enable'] AND THIS_SCRIPT == 'index')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "datastore
        SET data = data + 1
        WHERE title = 'boofocounter'
    "
);


Why not
PHP Code:

$db->shutdown_query("
    UPDATE " 
TABLE_PREFIX "datastore
    SET data = data + 1
    WHERE title = 'boofocounter'
"
); 

on forumhome_complete?

=> Less code to process less often, yet same result (if you also remove the unnecessary option to turn off the feature -> if users want to turn it off they will simply disable the product).

Boofo 05-18-2008 11:13 AM

OK, here's what you do. You go to user id 1's account and look at their join date. Use that as the site start date. Then calculate how many hits you "think" you've had and enter that in the hits setting. This is not rocket science. ;)

Boofo 05-18-2008 11:15 AM

Quote:

Originally Posted by Andreas (Post 1523378)
PHP Code:

if ($vbulletin->options['site_lifestatus_enable'] AND THIS_SCRIPT == 'index')
{
    
$vbulletin->db->query_write("
        UPDATE " 
TABLE_PREFIX "datastore
        SET data = data + 1
        WHERE title = 'boofocounter'
    "
);


Why not
PHP Code:

$db->shutdown_query("
    UPDATE " 
TABLE_PREFIX "datastore
    SET data = data + 1
    WHERE title = 'boofocounter'
"
); 

on forumhome_complete?

=> Less code to process less often, yet same result (if you also remove the unnecessary option to turn off the feature -> if users want to turn it off they will simply disable the product).

How it that going to process less often? It will still run on every page refresh, right? I am running that in the global_shutdown hook already.

Andreas 05-18-2008 11:22 AM

Currently the code is on global_shutdown, eg. being executed on every page.

But due to the condition it does the query only when the current script is index.php (forumhome).

So why not execute it just for index.php and avoid the condition on all other pages?
I don't see a reason for putting the code in a global place when there is an appropriate hook forumhome_complete that has exactly the context you want ;)

Boofo 05-18-2008 11:26 AM

OK, that makes sense. Code moved and setting deleted.

Can the starting count setting code stay in global_shutdown or should that be moved also?

And thanks for the heads up, sir. You know when you speak, I listen. ;)

Andreas 05-18-2008 11:28 AM

I'd remove that from frontend code and handle it completely within ACP:
Make appropriate plugins for the misc.php ACP script and let the user set the start there - no need for an option.

Boofo 05-18-2008 11:39 AM

OK, you lost me on that one. How would they set it?

sensimilla 05-18-2008 02:16 PM

Ive reinstalled it and now the visitors count is stuck at 0.

Boofo 05-18-2008 02:37 PM

Read the install file and do the file edit.

basilrath 05-18-2008 03:04 PM

Quote:

Site Startup Date: January 21, 2008
Site Age: 117 days, 11 hours, 3 minutes and 9 seconds
There have been 17,909 visitors to this page.
Average visits to this page: Hourly: 6, Daily: 152, Weekly: 1,067
Hey Boofo have you tested that average count yet......................it seems a great idea !

ps all work appreciated !


All times are GMT. The time now is 12:53 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.01257 seconds
  • Memory Usage 1,749KB
  • 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
  • (4)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)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