Cotonti / Open Source PHP Content Management FrameworkContent Management Framework

How deep the changes in the API should be?

14.8% 18
13.9% 17
13.9% 17
57.4% 70

122 Дата 20.04.2009 03:09

Форуми / Cotonti / Core Labs / Archive / Опитування: Plugin API changes

<<<123

How far can we go?

Trustmaster
#31 03.05.2009 14:08
Yes, so far seems like there isn't very much to change so it will be more of an update. The biggest change possible is callback concept but most likely it has more drawbacks than benefits so that we'll improve includes.

Auth system is quite painful. On one hand, we want it to be more detailed and have control over every option and every group (some people even request control over every user). From security point of view, ACL alone is not enough and is combined with hierarchical model. But even as it is now, auth system is huge data and slow access. I'm afraid before we add more and more items, we need to find some smart ways to make auth system more compact and faster access.

UPD

Finally I've completed my "callbacks vs. includes" experiment and here is the summary:
  • XCache is good for your health. With XCache there is absolutely no difference between callbacks and includes, not to mention things go significantly faster.
  • Without XCache includes are 5% slower than callbacks in loops and both are almost the same in normal hooks.
  • It takes 2 minuts to convert 1 plugin part to a callback.
To conclude it, callbacks are not so great on performance as we supposed. If 5% is really important for you, then your site is popular enough to run a dedi/VPS or at least ask your hoster for XCache.

So we will focus on improving includes() and architecture changes won't be so dramatic.
May the Source be with you!

Відредаговано: Trustmaster (04.05.2009 01:39, 11 років тому)
Dayver
#32 11.06.2009 08:34
I hope we have chosen Major upgrade (or Brand new but very carefully) ? I hope so!

# Trustmaster : OK, here is a list of suggestions I have collected so far:
[list=1]
  • Remove SED_EXTPLUGIN block from every single plugin file...
  • Specify hook bindings as an array in setup file like:
    $hooks = array(
    	array('filename1', 'hook1', 10),
    	array('filename1', 'hook2'),
    	array('filename2', 'hook3', 99)
    );
    where the third optional parameter is priority (order). As you can see, it also allows for multiple hook bindings.
  • Automatically preload plugin permissions into $usr['auth_read'], $usr['auth_write'] and $usr['isadmin'].
  • Automatically preload plugin langfile.
  • Already added in tickets: simplify CODE check. It can be
    defined('COT_CODE') or die('Wrong URL');
  • Time to change sed_ to cot_

  • More brainstorming while writing a plugin:

    7. Auth hooks. Add ability to affect auth in exact places (already known as EYOOP issue).

    8. SQL query hooks. There are some important queries that a plugin developer would like to modify before they get executed...


    I known that all the items we must to do because all these improvements will reduce the time to create new plugins! And we must do so now because the little time.


    # Trustmaster :
    UPD

    Finally I've completed my "callbacks vs. includes" experiment and here is the summary:
    • XCache is good for your health. With XCache there is absolutely no difference between callbacks and includes, not to mention things go significantly faster.
    • Without XCache includes are 5% slower than callbacks in loops and both are almost the same in normal hooks.
    • It takes 2 minuts to convert 1 plugin part to a callback.
    To conclude it, callbacks are not so great on performance as we supposed. If 5% is really important for you, then your site is popular enough to run a dedi/VPS or at least ask your hoster for XCache.

    So we will focus on improving includes() and architecture changes won't be so dramatic.

    This is good news. Thank you for your work!
    Pavel Tkachenko aka Dayver. Гик и веб мастер который делает сайты, увлекается электроникой и очень любит смотреть кино.
    О себе: Я злой и страшный серый волк, я в поросятах знааааюююю толк
    Xerora
    #33 11.06.2009 09:18
    I didn't really dig through the thread, but as far as the setup file, I suggest it being an xml file. It seems much cleaner and easier than nesting a load of arrays.

    <?xml version="1.0" encoding="UTF-8" ?>
    <setup version="1.0">
    
    	<information>
                    <type>module</type>
    		<code>gallery</code>
    		<name>Gallery</name>
    	</information>
    	
    	<hooks>
    		<hook location="standalone" file="photos" order="1" />
                    <hook location="main.first" file="loader" order="2" />
    	</hooks>
    	
    </setup>
    Trustmaster
    #34 11.06.2009 13:07
    XML files are quite massive on their own. We'll use PHP itself and try making it as compact as possible.
    May the Source be with you!
    GHengeveld
    #35 03.05.2010 18:15
    Instead of XML, we could consider JSON (it's becoming more and more widespread). Otherwise a PHP implementation (multidimensional arrays?) seems ok.

    Recently I've been working with AJAX plugins a LOT (custom implementation for a customer). I've already done some modification in the plug module to allow POST requests more easily.

    <<<123