Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
505 views
in Plugins by
edited by

Hi,
I was reading through the docs/codes and to understand the the execution plan for plugins. Though I grabbed a basic understanding of plugins run via eval command.

I am unsure if the entire code of Q2A is run via eval, it would be great if someone elaborate.
[UPDATE]: No Only Plugins run via eval.

It would be great if someone can explain in detail/or direct to a tutorial, about how the plugins are executed via eval methods and the stability issues, if any. Also has anyone tried a different approach to execute plugins other than eval.

Thanks

---- Answer ---
So far reading thru the code i understood.
1) First All the plugins files are loaded in qa_load_plugin_files function and within this a map of plugins, overrides  etc are loaded in the memory
2) Then the function 'qa_load_override_files' is invoked in which the plugin the functions are renamed and loaded in the memory via eval function.
Since i was not able to debug my code in eclipse due to the eval function, i made the following code 'qa_eval_from_file' function to help me debug the code. So far the code changes seem to be stable, i wish if the experts can review and suggest mistakes.

$path_parts = pathinfo($filename);
$newFile = $path_parts['dirname']."/".$path_parts['filename']."-evaled.".$path_parts['extension'];
        if ( !file_exists($newFile)){ // This can interfere if a new plugin is loaded. Think of a work around.
            $handle = fopen($newFile, "w+");
            fwrite($handle, $eval);
            fclose($handle);
            chmod($newFile, 0777)
        }
 include $newFile;

Q2A version: 1.6.3

Please log in or register to answer this question.

...