From b27cc72bf237732bfc6222682499f3c5f39480fe Mon Sep 17 00:00:00 2001 From: doktornotor Date: Sat, 15 Aug 2015 16:26:31 +0200 Subject: bandwidthd - code style and major improvements Only write upgraded config if there was something actually upgraded. --- config/bandwidthd/bandwidthd.inc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'config/bandwidthd/bandwidthd.inc') diff --git a/config/bandwidthd/bandwidthd.inc b/config/bandwidthd/bandwidthd.inc index 6edd255b..9364cbbc 100644 --- a/config/bandwidthd/bandwidthd.inc +++ b/config/bandwidthd/bandwidthd.inc @@ -335,9 +335,9 @@ function bandwidthd_upgrade_config() { $realif = get_real_interface($if); if (!preg_match("/pppoe[0-9]+/i", $realif)) { // and finally, set the new config value for config.xml - echo $if; $config['installedpackages']['bandwidthd']['config'][0]['interface_array'][$i] = $if; $i++; + $changes++; } } } @@ -346,7 +346,9 @@ function bandwidthd_upgrade_config() { unset($config['installedpackages']['bandwidthd']['config'][0]['subnets_custom']); } // Write the upgraded config.xml if something changed - write_config("[bandwidthd] Upgraded old package configuration."); + if ($changes > 0 ) { + write_config("[bandwidthd] Upgraded old package configuration."); + } } function bandwidthd_validate_input($post, &$input_errors) { -- cgit v1.2.3