diff options
author | Seth Mos <seth.mos@xs4all.nl> | 2009-03-13 02:43:57 +0100 |
---|---|---|
committer | Seth Mos <seth.mos@xs4all.nl> | 2009-03-13 02:43:57 +0100 |
commit | 957d8f756240363ad43ac68a4c18b7f9e8e1c57b (patch) | |
tree | 19012d4f239df5f6b193981bcd80ff29b5b71c2b /etc/inc/config.inc | |
parent | 6edc48fe40c2167182cd88a86c43de8f514e5531 (diff) | |
download | pfsense-957d8f756240363ad43ac68a4c18b7f9e8e1c57b.zip pfsense-957d8f756240363ad43ac68a4c18b7f9e8e1c57b.tar.gz |
Rewrite the rrd upgrade code to use the newly added xml2array function specifically for the rrd upgrade code.
This is about 4 times faster then our builtin parser. Hoping this can solve part of the the 45 minute upgrade cycles on
embedded builds
Diffstat (limited to 'etc/inc/config.inc')
-rw-r--r-- | etc/inc/config.inc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/etc/inc/config.inc b/etc/inc/config.inc index faf5af7..7c8597e 100644 --- a/etc/inc/config.inc +++ b/etc/inc/config.inc @@ -2086,7 +2086,9 @@ endif; mwexec("$rrdtool tune {$rrddbpath}{$database} -r roundtrip:delay 2>&1"); dump_rrd_to_xml("{$rrddbpath}/{$database}", "{$g['tmp_path']}/{$xmldump}"); - $rrdold = parse_xml_config_raw("{$g['tmp_path']}/{$xmldump}", "rrd"); + $rrdoldxml = file_get_contents("{$g['tmp_path']}/{$xmldump}"); + $rrdold = xml2array($rrdoldxml, 1, "tag"); + $rrdold = $rrdold['rrd']; $i = 0; foreach($rrdold['rra'] as $rra) { @@ -2140,9 +2142,14 @@ endif; /* create temporary xml from new RRD */ dump_rrd_to_xml("{$g['tmp_path']}/{$databasetmp}", "{$g['tmp_path']}/{$xmldumptmp}"); - $rrdold = parse_xml_config_raw("{$g['tmp_path']}/{$xmldump}", "rrd"); - $rrdnew = parse_xml_config_raw("{$g['tmp_path']}/{$xmldumptmp}", "rrd"); - + $rrdoldxml = file_get_contents("{$g['tmp_path']}/{$xmldump}"); + $rrdold = xml2array($rrdoldxml, 1, "tag"); + $rrdold = $rrdold['rrd']; + + $rrdnewxml = file_get_contents("{$g['tmp_path']}/{$xmldumptmp}"); + $rrdnew = xml2array($rrdnewxml, 1, "tag"); + $rrdnew = $rrdnew['rrd']; + /* remove any MAX RRA's. Not needed for traffic. */ $i = 0; foreach ($rrdold['rra'] as $rra) { @@ -2156,7 +2163,6 @@ endif; $rrdxml = dump_xml_config_raw($rrdxmlarray, "rrd"); file_put_contents("{$g['tmp_path']}/{$xmldumpnew}", $rrdxml); mwexec("$rrdtool restore -f {$g['tmp_path']}/{$xmldumpnew} {$rrddbpath}/{$database} 2>&1"); - // mwexec("$rrdtool resize {$rrddbpath}/{$database} 3 GROW 3000 2>&1"); } enable_rrd_graphing(); |