[ewiki] Re: UserVars Dependant plugins
- From: Mario Salzer <mario@xxxxxxxxxxxxx>
- To: ewiki@xxxxxxxxxxxxx
- Date: Thu, 13 May 2004 02:46:13 +0200
> Delay and move sound fine.
There is only the <pre>+markup-bug left, that prevents the next
major release IMO.
>
> 1. When should it be loaded - first init plugin I presume? What if the
> _auth code would like to use it immediately after establishing the identity
> in global code? Maybe the auth code should call the loader? How does it
> know which one?
If we simply used $_EWIKI, then uservars (only for the current user) are
transparently retrieved and stored. This would happend outside of ewiki;
that is the array was initialized before most other plugins, and it would
be stored back when the PHP interpreter terminates (register_shutdown_f).
- I believe the uservars should be really separate from the authentication
stuff. Usually it would be implemented with sessions, and even didn't
require authentication (it was only for persistent preference saving and
such things).
- The simplest thing that could possibly work was
$_EWIKI=$_SESSION["_EWIKI"] for retrieval; $_SESSION["_EWIKI"]=$_EWIKI
for later storage.
- Such a simple global array was a lot easier and faster than _set() and
_get() functions.
If uservars should be initialized from an user account, an [_auth] or
[init] plugin would do all this instead.
>
> 3. (The big one) How do I access someone else's uservars? I expect I'll
> need to get, set, and search for values on another user. Is this the same
> case you see as random access?
Yes, that is where you really need the API. However this is probably only
needed in administrative plugins, or if there was a statistic to generate
about user preferences / accounts. What on the other hand was nearly
impossible anyhow, if the uservars were simply stored by PHPs` session
management like I suggested.
My point is, that it was a lot more flexible if we treat uservars /
preferences separate from user accounts and/or authentication accounts.
This may complicate a few other things, but it's easier for integration
into a container/parent-CMS if we don't introduce another API that needs
to be implemented (_EWIKI+_SESSION seems simpler to integrate).
>
> Looking at the API then we could:
A general [_retrieve] and [_store] is probably the only thing necessary,
if it retrieves all uservars (for a given user) at once - in the array
fashion as suggested. It is easier to modify entries in an array and store
it back, than it is to call _set(), _get() and _clear() functions.
The only other thing that API needs is a account listing (_getall)
function, if it is possible for the implemented uservars backend
(which was not without headaches for the simple PHPsession storage).
mario
- References:
- [ewiki] Re: UserVars Dependant plugins
- From: Andy Fundinger
Other related posts:
- » [ewiki] UserVars Dependant plugins
- » [ewiki] Re: UserVars Dependant plugins
- » [ewiki] Re: UserVars Dependant plugins
- » [ewiki] Re: UserVars Dependant plugins
- [ewiki] Re: UserVars Dependant plugins
- From: Andy Fundinger