Parsing inifiles the easy way
13 August 2008
Raphael has been doing a lot of work to make processing of INI-style files in Augeas easy and painless. It’s now at the point that you can describe /etc/php.ini in a few lines:
module PHP =
autoload xfm
let entry = IniFile.entry /[a-z][a-z0-9\._-]+/
let record = IniFile.record "section" entry
let lns = IniFile.lns record
let filter = (incl "/etc/php*/*/php.ini")
. Util.stdexcl
let xfm = transform lns filter
That’s all you need to have Augeas suck PHP ini files into its tree — turning on safe mode requires exactly two commands in augtool:
set /files/etc/php.ini/PHP/safe_mode On save