diff options
author | Renato Botelho <garga@FreeBSD.org> | 2013-09-03 12:35:13 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2013-09-03 12:37:41 -0300 |
commit | f2cc3344a19134a3dc594ff767be06f5af800553 (patch) | |
tree | 93df593b5dba3c5c7460d6a0a5002890aebcfa3f /etc/inc/upgrade_config.inc | |
parent | a8ab2b76f1a9662a1b08f2938a86aa05300b48c1 (diff) | |
download | pfsense-f2cc3344a19134a3dc594ff767be06f5af800553.zip pfsense-f2cc3344a19134a3dc594ff767be06f5af800553.tar.gz |
Fix #3004:
. Create a function to replace strings on deep associative arrays
. Use the recent created function array_replace_values_recursive to fix
VIP interface names instead of touch config.xml directly
Diffstat (limited to 'etc/inc/upgrade_config.inc')
-rw-r--r-- | etc/inc/upgrade_config.inc | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index a78c393..569dd3a 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2898,16 +2898,11 @@ function upgrade_085_to_086() { foreach ($config['virtualip']['vip'] as $vip) { if ($vip['mode'] != "carp") continue; - $vipchg[] = "s/\\([^_]\\)vip{$vip['vhid']}\\([^0-9]\\)/\\1{$vip['interface']}_vip{$vip['vhid']}\\2/g\n"; - } - if (!empty($vipchg)) { - file_put_contents("{$g['tmp_path']}/vipreplace", $vipchg); - write_config(); - mwexec("/usr/bin/sed -I \"\" -f {$g['tmp_path']}/vipreplace {$g['conf_path']}/config.xml"); - require_once("config.lib.inc"); - unset($config); - $config = parse_config(true); - @unlink("{$g['tmp_path']}/vipreplace"); + $config = array_replace_values_recursive( + $config, + '^vip' . $vip['vhid'] . '$', + "{$vip['interface']}_vip{$vip['vhid']}" + ); } } } |