[dev] Horde 5 was: Re: [commits] Horde branch develop updated. fa956a4d83a7227e2a5d47bfe87185854e151fbc

Michael M Slusarz slusarz at horde.org
Sat Mar 3 01:38:06 UTC 2012


Quoting Jan Schneider <jan at horde.org>:

> Zitat von Michael M Slusarz <slusarz at horde.org>:
>
>> But while it is fresh on my mind, and so that I have a record of  
>> it, thought I would lay down some elements on how to fix the whole  
>> Registry init mess that led to this thread.  The way I see it, we  
>> need the following:
>>
>> init(): Given the fact that people have been using this method  
>> incorrectly, its probably best renamed to something like  
>> bootstrap().  It's the minimum code necessary to allow the registry  
>> to access the application framework (NOT the application data).   
>> E.g. setting up factories.  This method is potentially called  
>> before an application is authenticated, and possibly before the  
>> framework is available.
>>
>> authenticateInit(): This is a method that is called ONCE per  
>> session, when an application is authenticated to.
>>
>> init() (or onPush()?): This is a method that is called ONCE per  
>> page load, when the application is first pushed onto the stack.   
>> This is where global application initialization can be done,  
>> although as a practical matter things should be auto-loaded as  
>> needed to reduce resources.
>
> +1
>
> My method name suggestions: bootstrap(),  
> authenticated()/onAuth()/onAuthenticate(), start()/init()

My first take on this was pushed last night.  I've also done a bunch  
of work today that I can't yet push because the git server is down  
again.  Here's what I've come up with so far:

* Remove hasAjaxView()/hasMobileView().  Consolidate on hasView() so  
that 1) we can query all view types, 2) reduce complexity, 3)  
potentially add further views in the future

* Remove specific object feature properties from the Application  
object (e.g. $ajaxView, $mobileView) and move all feature detection to  
an array property ($features).  Allows for extensibility in the  
future.  Add Horde_Registry#hasFeature() to access these properties.

* Change Notification/Alarm handle checking to use feature detection  
rather than the more involved method of calling methods.

* Developed the following initialization framework.  These are all  
protected functions to be implemented in the
   sub-classed - the public methods that are first called are defined  
in the base Application object and are
   unchangeable.

   - _bootstrap(): Called when application object is first created.   
Framework may not be available.  User may
     not be authenticated

   - _authenticated(): Called when user is authenticated to  
application.  Called once per session.  Full
     framework available.  Will be called before _init().  May not be  
called on the same page access as the
     actual authentication.

     Moved the session variable caching code from IMP/Gollem to the  
base class.  It is needed when the
     authentication methods in an application create some session  
variables, but these session variables cannot
     be saved yet since the authenticated session has not yet been  
created by the Registry.  These variables can
     be saved by calling _addSessVars() from within the authentication methods
     (authAuthenticate()/authTransparent())

   - _init(): Called when application is pushed onto stack for the  
first time in a page access.  Full framework
     available.  User MAY NOT be authenticated.  Will be re-called if  
_authenticated() is called on a page.

* Tried to clean up our init hooks a bit:

   - Moved the 'appinitialized' hook -> 'appauthenticated' hook to  
better reflect its use.
     This hook is called immediately after authenticated()

   - The 'pushapp' hook is now called immediately after init().

   - The 'pushapp_post' hook has been removed.

michael

___________________________________
Michael Slusarz [slusarz at horde.org]



More information about the dev mailing list