Project

General

Profile

« Previous | Next » 

Revision ca676aa3

Added by Jim Pingle over 5 years ago

More safety belts for upgrade_174_to_175(). Fixes #10458

View differences:

src/etc/inc/upgrade_config.inc
5479 5479
	if (count($config['ipsec']['phase1'])) {
5480 5480
		$a_phase1 = &$config['ipsec']['phase1'];
5481 5481
		foreach($a_phase1 as &$phase1) {
5482
			if (empty($phase1)) {
5482
			if (empty($phase1) || !is_array($phase1)) {
5483 5483
				continue;
5484 5484
			}
5485 5485
			$item = array();
5486
			$item['encryption-algorithm'] = $phase1['encryption-algorithm'];
5487
			$item['hash-algorithm'] = $phase1['hash-algorithm'];
5488
			$item['dhgroup'] = $phase1['dhgroup'];
5489
			$phase1['encryption']['item'][] = $item;
5490
			unset($phase1['encryption-algorithm']);
5491
			unset($phase1['hash-algorithm']);
5492
			unset($phase1['dhgroup']);
5486
			if (isset($phase1['encryption-algorithm']) && !empty($phase1['encryption-algorithm'])) {
5487
				$item['encryption-algorithm'] = $phase1['encryption-algorithm'];
5488
				unset($phase1['encryption-algorithm']);
5489
			}
5490
			if (isset($phase1['hash-algorithm']) && !empty($phase1['hash-algorithm'])) {
5491
				$item['hash-algorithm'] = $phase1['hash-algorithm'];
5492
				unset($phase1['hash-algorithm']);
5493
			}
5494
			if (isset($phase1['dhgroup']) && !empty($phase1['dhgroup'])) {
5495
				$item['dhgroup'] = $phase1['dhgroup'];
5496
				unset($phase1['dhgroup']);
5497
			}
5498
			if (!empty($item)) {
5499
				if (!is_array($phase1['encryption'])) {
5500
					$phase1['encryption'] = array();
5501
				}
5502
				if (!is_array($phase1['encryption']['item'])) {
5503
					$phase1['encryption']['item'] = array();
5504
				}
5505
				$phase1['encryption']['item'][] = $item;
5506
			}
5493 5507
		}
5494 5508
	}
5495 5509
}

Also available in: Unified diff