Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-09-2005, 10:55 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default evaled on page generation

Quote:
First and foremost plug-ins are stored in the database, serlized, unserlized and evaled on page generation.
What exactly does the part in bold mean, and is there a risk of variable name collision?
Reply With Quote
  #2  
Old 06-09-2005, 11:03 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If you take a look at table datastore for record pluginlist you will find smth. linke this:

Code:
a:1:{s:12:"global_start";s:32:"// some code for hook global.php"}
This is a serialized array.
Upon execution it will be unserialized:
PHP Code:
$pluginlist['global_start'] = '// Some code for global.php'
Then this code will be executed:
PHP Code:
eval($pluginlist['global_start']); 
Variable collisions are always possible.
As this unserializing and evaluating is being done at execution time it generates overhead. So for larger code modifications you might want to use include files - then less code must be unserailized and evaled.
Include files can also be pre-compiled/cached -> eAccelerator/ZEND Performance Suite/etc.
Reply With Quote
  #3  
Old 06-09-2005, 11:06 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

When are plugins first available, i.e., is a plugin first available in init.php or global.php or ???
Reply With Quote
  #4  
Old 06-09-2005, 11:07 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I don't understand this question.
Reply With Quote
  #5  
Old 06-09-2005, 11:09 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
As this unserializing and evaluating is being done at execution time it generates overhead. So for larger code modifications you might want to use include files - then less code must be unserailized and evaled.
Include files can also be pre-compiled/cached -> eAccelerator/ZEND Performance Suite/etc.
So, do you mean just use an include statement to not store so much stuff? By evaluating, do you mean just the plugin code is evaluated, or is it all included files?

Quote:
Originally Posted by KirbyDE
I don't understand this question.
Say I make a plugin that sets variable $foo - I am wondering when $foo is first available: a) by plugin and b) by hack.

EDIT: Argh, the Automerged Doublepost got me!
Reply With Quote
  #6  
Old 06-09-2005, 11:15 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Only the include statement. Of yourse the included file must aso be parsed/compiled, but as already said files can be cached.

Quote:
Originally Posted by calorie
Say I make a plugin that sets variable $foo - I am wondering when $foo is first available: a) by plugin and b) by hack.
I don't understand this question, sorry.
What to you want to know - variable scope?
If your plugin is being called from within a function, the any variables you set (if you don't define them as global) will only be visible within this function.
If your plugin is being called from a global scope, then variables will be global.
Reply With Quote
  #7  
Old 06-09-2005, 11:18 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay, thanks. Now when is $foo from a plugin first available, i.e., what is the first file that $foo will be able to be used in, if $foo is set via plugin?
Reply With Quote
  #8  
Old 06-09-2005, 11:20 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by calorie
Okay, thanks. Now when is $foo from a plugin first available, i.e., what is the first file that $foo will be able to be used in, if $foo is set via plugin?
$foo will be available after the plugin was called.
Reply With Quote
  #9  
Old 06-09-2005, 11:24 PM
calorie calorie is offline
 
Join Date: May 2003
Posts: 2,804
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by KirbyDE
$foo will be available after the plugin was called.
Right, but when is the plugin first called? I see some code in init.php, so are hooks/plugins available at the end of init.php but before global.php?
Reply With Quote
  #10  
Old 06-09-2005, 11:27 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by calorie
Right, but when is the plugin first called?
That depends on the hook you are using.
The first hook being called is fetch_userinfo from init.php (line 362):
PHP Code:
$vbulletin->userinfo =& $vbulletin->session->fetch_userinfo(); 
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:08 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.03906 seconds
  • Memory Usage 2,257KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)bbcode_code
  • (3)bbcode_php
  • (7)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete