mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
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.
This commit is contained in:
parent
bf4b25969e
commit
c3ce2eced4
@ -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",
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user