vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   evaled on page generation (https://vborg.vbsupport.ru/showthread.php?t=82766)

calorie 06-09-2005 10:55 PM

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?

Andreas 06-09-2005 11:03 PM

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.

calorie 06-09-2005 11:06 PM

When are plugins first available, i.e., is a plugin first available in init.php or global.php or ???

Andreas 06-09-2005 11:07 PM

I don't understand this question.

calorie 06-09-2005 11:09 PM

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! :D

Andreas 06-09-2005 11:15 PM

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.

calorie 06-09-2005 11:18 PM

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?

Andreas 06-09-2005 11:20 PM

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.

calorie 06-09-2005 11:24 PM

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?

Andreas 06-09-2005 11:27 PM

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(); 



All times are GMT. The time now is 08:22 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.01177 seconds
  • Memory Usage 1,738KB
  • 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
  • (3)bbcode_php_printable
  • (7)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (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