vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Hook to replace (https://vborg.vbsupport.ru/showthread.php?t=110075)

ericgtr 03-11-2006 01:32 PM

Hook to replace
 
I am not sure if this is possible but I would like to use the hook system if I can for this.

In attachment.php I have this code:
PHP Code:

        // or doing it once an hour
        
$query "INSERT INTO " TABLE_PREFIX "attachmentviews (attachmentid)
            VALUES (
$attachmentinfo[attachmentid])
        "
;
        
defined('NOSHUTDOWNFUNC') ? $db->query_write($query) : $db->shutdown_query($query);
    } 

I would like to replace it with this:
PHP Code:

        // or doing it once an hour
        
$query "INSERT INTO " TABLE_PREFIX "attachmentviews (attachmentid, timestamp)
            VALUES (
$attachmentinfo[attachmentid], " TIMENOW ")
        "
;
        
defined('NOSHUTDOWNFUNC') ? $db->query_write($query) : $db->shutdown_query($query);
    } 

It would be nice if I didn't have to force the user to edit the file for this mod :)

Trigunflame 03-11-2006 01:46 PM

Quote:

Originally Posted by ericgtr
I am not sure if this is possible but I would like to use the hook system if I can for this.

In attachment.php I have this code:
PHP Code:

        // or doing it once an hour
        
$query "INSERT INTO " TABLE_PREFIX "attachmentviews (attachmentid)
            VALUES (
$attachmentinfo[attachmentid])
        "
;
        
defined('NOSHUTDOWNFUNC') ? $db->query_write($query) : $db->shutdown_query($query);
    } 

I would like to replace it with this:
PHP Code:

        // or doing it once an hour
        
$query "INSERT INTO " TABLE_PREFIX "attachmentviews (attachmentid, timestamp)
            VALUES (
$attachmentinfo[attachmentid], " TIMENOW ")
        "
;
        
defined('NOSHUTDOWNFUNC') ? $db->query_write($query) : $db->shutdown_query($query);
    } 

It would be nice if I didn't have to force the user to edit the file for this mod :)

The query is being executed directly after it is assigned; the only way you theoretically could modify it is if a hook was placed directly after the $query = "whatever"; and then have your own $query = 'whatever'; that would overwrite it.

But looking at that, there is no way to do it through a plugin for replacing the sql in that query.

ericgtr 03-12-2006 12:27 AM

That's pretty much what I figured, thanks for confirming.


All times are GMT. The time now is 03:10 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.01605 seconds
  • Memory Usage 1,739KB
  • 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
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete