Re: Config class
| From: | Bertrand Mansion | Date: | Thu, 25 Jul 2002 18:22:36 +0000 |
| Subject: | Re: Config class | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-7999@lists.php.net to get a copy of this message | ||
le 25/07/02 19:57, Chuck Hagenbuch à chuck@horde.org a écrit :
> Quoting Bertrand Mansion <bmansion@mamasam.com>:
>
>> Yes, I would like to add methods for delete, add, replace lines in config
>> files. Presently, configuration parameter lines are not stored in the
>> data array, I would like to add that.
Hi Chuck,
> Along the lines of general PEAR config stuff, I just wrote a config system
> for Horde which:
>
> 1. Has a conf.xml file as the master source for what values there are and
> what their defaults are.
I thought about such an extension for the future. image if every application
available had such a conf.xml file !
> 2. Also reads defaults from a conf.php, so that a users existing settings
> are respected any time the config system is run.
>
> 3. Uses a Horde form library to auto-generate a UI from the .xml, which
> includes type information (is this config item a string, a boolean, a select
> list) and descriptions, so all the metadata for the config information is
> there in the XML.
This I can do easily with QuickForm and a small xml parser.
> 4. Writes out (or generates for cut+paste, or whatever) the new conf.php,
> which is a nicely compact .php file (comments aren't really needed since
> it's maintained by the system, and the comments will always be there in the
> XML).
What does your conf.php file looks like ? xml, php .ini, properties,
apache-like conf or just standard php code ?
The Config class I am writing should be able to parse any existing config
file, as long as there is a container written for the format, and will
probably be able to modify it without loosing the initial layout. Plus,
using regex, it should keep comments where they are. (well, I hope so...)
I made some tests with htdig.conf, resolv.conf, man.conf, php.ini (these are
the config files installed on my machine) and it seems to work, I just need
to change the comments, delimiter and follow tags to adapt to the different
format. htdig uses ':' and '#', php uses '=' and ';'...
But I would be very interested to see how your xml file looks like.
Is it in the horde cvs ?
> Now that the PEAR installer is more or less working, I'd be up for putting
> more libs and stuff like this into PEAR, if anyone's interested.
You might also want to help me with the Config class in order to make it
work with your conf.php file.
Cheers,
Bertrand Mansion
Mamasam