From: Martin G. <gim...@gi...> - 2002-09-16 17:41:09
|
Jeff Dairiki <da...@da...> writes: > I think it would be real slick if the config script got all its info > from (specially formatted) comments (and code) in the dist-config > file. (Maybe it already works that way?) No, it doesn't work that way. The configurator knows nothing about the config-dist.php file at the moment. But I agree that it would be cool to have the configurator get it's data from a config-dist.php file which should be a fully functional file itself. Perhaps something we could extend the JavaDoc like comments: <?php /*# * Select driver for X. * * If you want to do X, then you have to select the right * driver. * * #type select * #choices foo bar baz * #depends Y */ if (!defined('X')) define('X', 'foo'); /*# * The greeting * * Please specify a greeting. * * #type text * #default Hello World */ if (!defined('Y')) define('Y', 'Hello World'); ?> I just don't know how this scheme could be made general enough to work with all cases. For PhpWeather I have a system with dependencies and validators which gives me a lot of flexibility. I think it will be hard to turn that into a system with enhanced comments. Unless, of course we simply hide the relevant PHP code in a comment and then have the configurator execute it: <?php /* ## Begin configurator code * * $port_validator = new pw_validator_range("Sorry, '%s' is not a valid port-number " . * "because is't outside the range 1-65536", * 1, 65536); * * $proxy_dep = new pw_dependency('use_proxy', 'true'); * * $options['proxy_port'] = * new pw_option_integer('proxy_port', * "This is the port number of the proxy server. The " . * "default is what is used by the Squid proxy server. " . * "Another common port number is '8080'", * array($proxy_dep), $port_validator, 3128); * * ## End configurator code */ The configurator script could find the right comment, strip the leading ' * ' from each line and run it through exec(). But isn't this getting kind of silly now? :-) > Then problems with keeping the configurator in sync with the config > options go away.... -- Martin Geisler My GnuPG Key: 0xF7F6B57B See http://gimpster.com/ and http://phpweather.net/ for: PHP Weather => Shows the current weather on your webpage and PHP Shell => A telnet-connection (almost :-) in a PHP page. |