diff options
author | smos <seth.mos@dds.nl> | 2012-04-18 17:31:36 +0200 |
---|---|---|
committer | smos <seth.mos@dds.nl> | 2012-04-18 17:33:37 +0200 |
commit | c3ce2eced406efb771f0dc796633c7489cc944ba (patch) | |
tree | b9263d5d45d9b8dee766fc9b1ddd93be5640e58e /etc/inc | |
parent | bf4b25969e814662ae11c82a6ba491f422e0b57c (diff) | |
download | pfsense-c3ce2eced406efb771f0dc796633c7489cc944ba.zip pfsense-c3ce2eced406efb771f0dc796633c7489cc944ba.tar.gz |
Add upgrade code that updates the dynamic gateway names to their new format new $if_$type.
Redmine Ticket #2332. I've tested a simple upgrade with 3 dynamic Wans with varying names and that appears to have succeeded. Needs more testing.
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/globals.inc | 2 | ||||
-rw-r--r-- | etc/inc/upgrade_config.inc | 36 |
2 files changed, 37 insertions, 1 deletions
diff --git a/etc/inc/globals.inc b/etc/inc/globals.inc index dda1935..6544b89 100644 --- a/etc/inc/globals.inc +++ b/etc/inc/globals.inc @@ -77,7 +77,7 @@ $g = array( "disablecrashreporter" => false, "crashreporterurl" => "http://crashreporter.pfsense.org/crash_reporter.php", "debug" => false, - "latest_config" => "8.4", + "latest_config" => "8.5", "nopkg_platforms" => array("cdrom"), "minimum_ram_warning" => "101", "minimum_ram_warning_text" => "128 MB", diff --git a/etc/inc/upgrade_config.inc b/etc/inc/upgrade_config.inc index 42396f5..251de29 100644 --- a/etc/inc/upgrade_config.inc +++ b/etc/inc/upgrade_config.inc @@ -2767,4 +2767,40 @@ function upgrade_083_to_084() { } } +function upgrade_084_to_085() { + global $config; + + $gateway_group_arr = array(); + $gateways = return_gateways_array(); + $oldnames = array(); + /* setup translation array */ + foreach($gateways as $name => $gw) { + if(isset($gw['dynamic'])){ + $oldname = strtoupper($config['interfaces'][$gw['friendlyiface']]['descr']); + $oldnames[$oldname] = $name; + } else { + $oldnames[$name] = $name; + } + } + + /* process the old array */ + if(is_array($config['gateways']['gateway_group'])) { + $group_array_new = array(); + foreach($config['gateways']['gateway_group'] as $name => $group) { + if(is_array($group['item'])) { + $newlist = array(); + foreach($group['item'] as $entry) { + $elements = explode("|", $entry); + if($oldnames[$elements[0]] <> "") { + $newlist[] = "{$oldnames[$elements[0]]}|{$elements[1]}"; + } + } + $group['item'] = $newlist; + $group_array_new[$name] = $group; + } + } + $config['gateways']['gateway_group'] = $group_array_new; + } +} + ?> |