|
| 1 | +(* PHP module for Augeas *) |
| 2 | +(* Author: Raphael Pinson < [email protected]> *) |
| 3 | +(* *) |
| 4 | + |
| 5 | +module PHP = |
| 6 | + autoload xfm |
| 7 | + |
| 8 | +(************************************************************************ |
| 9 | + * INI File settings |
| 10 | + *************************************************************************) |
| 11 | + |
| 12 | +let comment = IniFile.comment IniFile.comment_re IniFile.comment_default |
| 13 | +let sep = IniFile.sep IniFile.sep_re IniFile.sep_default |
| 14 | +let empty = IniFile.empty |
| 15 | + |
| 16 | + |
| 17 | +(************************************************************************ |
| 18 | + * ENTRY |
| 19 | + * |
| 20 | + * We have to remove the keyword "section" from possible entry keywords |
| 21 | + * otherwise it would lead to an ambiguity with the "section" label |
| 22 | + * since PHP allows entries outside of sections. |
| 23 | + *************************************************************************) |
| 24 | +let entry = |
| 25 | + let word = IniFile.entry_re |
| 26 | + in let entry_re = word . ( "[" . word . "]" )? |
| 27 | + in IniFile.indented_entry entry_re sep comment |
| 28 | + |
| 29 | + |
| 30 | +(************************************************************************ |
| 31 | + * TITLE |
| 32 | + * |
| 33 | + * We use IniFile.title_label because there can be entries |
| 34 | + * outside of sections whose labels would conflict with section names |
| 35 | + *************************************************************************) |
| 36 | +let title = IniFile.title ( IniFile.record_re - ".anon" ) |
| 37 | +let record = IniFile.record title entry |
| 38 | + |
| 39 | +let record_anon = [ label ".anon" . ( entry | empty )+ ] |
| 40 | + |
| 41 | + |
| 42 | +(************************************************************************ |
| 43 | + * LENS & FILTER |
| 44 | + * There can be entries before any section |
| 45 | + * IniFile.entry includes comment management, so we just pass entry to lns |
| 46 | + *************************************************************************) |
| 47 | +let lns = record_anon? . record* |
| 48 | + |
| 49 | +let filter = (incl "/etc/php*/*/*.ini") |
| 50 | + . (incl "/etc/php.ini") |
| 51 | + . (incl "/etc/php.d/*.ini") |
| 52 | + (* PHPFPM Support *) |
| 53 | + . (incl "/etc/php*/fpm/pool.d/*.conf") |
| 54 | + (* Zend Community edition *) |
| 55 | + . (incl "/usr/local/zend/etc/php.ini") |
| 56 | + . (incl "/usr/local/zend/etc/conf.d/*.ini") |
| 57 | + . Util.stdexcl |
| 58 | + |
| 59 | +let xfm = transform lns filter |
0 commit comments