[geeklog-devel] Config class
Joe Mucchiello
joe at ThrowingDice.com
Mon Jan 28 16:06:07 EST 2008
Is there a reason the config class does not also deal with user
configurations? Was it just out of scope for the GSOC? Seems to me
most user config stuff is stuff that overrides a plugin's $_PLG_CONF
array. Basically if I want to have configuable option in my plugin,
the admin gets a builtin place to go set them. But if I want settings
for the users I have to roll my own.
Here's my thoughts on how it could be done without too much hassle.
And it would eliminate lots of little tables in the database.
Modify the conf_values table, add a by_user boolean. If true, the
field can be set individually by user.
Create a conf_user_values table: uid, group, name, value
Add a global array to the class containing all the group/name pairs
that can be set individually (saves a SELECT in several routines)
Modify the add() function to include the "by_user" boolean.
Modify the initconfig() function to read values out of the
conf_user_values table after reading the main table. And to setup the
new global array
Modify the set() function with a new parameter "$target". It defaults
to system where it modifies the system value of the parameter. The
other value is 'user' where, after making sure the parameter can be
set individually, it set the user table's value.
Modify restore_param and unset_param similarly to set() although
unset_param($target = 'user') is a delete.
The del() function just needs to hit both tables.
The ui function would need flags for whether they show the system
values or the user values. There also might need to be flags for just
showing one group of config options.
Well, that's a lot of bullet points but none of them are very complex.
----
Joe Mucchiello
Throwing Dice Games
http://www.throwingdice.com
More information about the geeklog-devel
mailing list