[pmwiki-users] most user-friendly method of database configuration

Patrick R. Michaud pmichaud at pobox.com
Fri Oct 13 13:40:31 CDT 2006

On Fri, Oct 13, 2006 at 12:49:32PM -0500, Ben Stallings wrote:
> What I really want to do, I suppose, is allow people to add as many 
> DataStore objects (i.e. databases) as they like to their $WikiLibDirs 
> (i.e. places the wiki looks for pages).  (This is assuming, of course, 
> that I get the recipe finished in the near future!)
> ...
> Trouble is, I have a sneaking suspicion that multi-dimensional arrays, 
> with their fickle commas and their nested parentheses, are intimidating 
> to people who don't eat PHP for breakfast.  
> ...
> So I'm wondering if it might actually be easier to have people add the 
> DataStore objects to their $WikiLibDirs manually rather than putting the 
> info into either a set of constants or a variable.  

I think it's far simpler to have people add the DataStore objects
to $WikiLibDirs, as well as providing more flexibility on the
other end.

I would do

    $WikiLibDirs[] = new DataStore(array(
                      'type' => 'mysql',
                      'server' => 'db.example.com',
                      'name' => 'example_database_name',
                      'user' => 'example_user',
                      'passwd' => 'example_password'));

which allows for a lot of extensibility in terms of future
parameters to be passed, while also making it easy for someone to
remember what everything stands for.


More information about the pmwiki-users mailing list