From ee34e13739d301936f335098f5ba48742edddb12 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Mon, 14 Apr 2014 04:23:18 -0700 Subject: [PATCH] Do not allow upgrade_101_to_102 to exit early This upgrade step does both Captive Portal stuff and OpenVPN stuff. So do not return early just because there is no Captive Portal config. Both Captive Portal and OpenVPN tests changed to be positive tests, to make sure that everything is checked/tested and there is no chance to return early. --- etc/inc/upgrade_config.inc | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index b146946691..b453f824a5 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -3182,32 +3182,30 @@ function upgrade_100_to_101() { function upgrade_101_to_102() { global $config, $g; - if (!is_array($config['captiveportal'])) - return; + if (is_array($config['captiveportal'])) { + foreach ($config['captiveportal'] as $cpzone => $cp) { + if (!is_array($cp['passthrumac'])) + continue; - foreach ($config['captiveportal'] as $cpzone => $cp) { - if (!is_array($cp['passthrumac'])) - continue; - - foreach ($cp['passthrumac'] as $idx => $passthrumac) - $config['captiveportal'][$cpzone]['passthrumac'][$idx]['action'] = 'pass'; + foreach ($cp['passthrumac'] as $idx => $passthrumac) + $config['captiveportal'][$cpzone]['passthrumac'][$idx]['action'] = 'pass'; + } } /* Convert OpenVPN Compression option to the new style */ // Nothing to do if there is no OpenVPN tag - if (!isset($config['openvpn']) || !is_array($config['openvpn'])) - return; - - if (is_array($config['openvpn']['openvpn-server'])) { - foreach ($config['openvpn']['openvpn-server'] as &$vpn) { - if (!empty($vpn['compression'])) - $vpn['compression'] = "adaptive"; + if (isset($config['openvpn']) && is_array($config['openvpn'])) { + if (is_array($config['openvpn']['openvpn-server'])) { + foreach ($config['openvpn']['openvpn-server'] as &$vpn) { + if (!empty($vpn['compression'])) + $vpn['compression'] = "adaptive"; + } } - } - if (is_array($config['openvpn']['openvpn-client'])) { - foreach ($config['openvpn']['openvpn-client'] as &$vpn) { - if (!empty($vpn['compression'])) - $vpn['compression'] = "adaptive"; + if (is_array($config['openvpn']['openvpn-client'])) { + foreach ($config['openvpn']['openvpn-client'] as &$vpn) { + if (!empty($vpn['compression'])) + $vpn['compression'] = "adaptive"; + } } } }