Project

General

Profile

« Previous | Next » 

Revision f2cc3344

Added by Renato Botelho almost 12 years ago

Fix #3004:

. Create a function to replace strings on deep associative arrays
. Use the recent created function array_replace_values_recursive to fix
VIP interface names instead of touch config.xml directly

View differences:

etc/inc/util.inc
1826 1826
	return false;
1827 1827
}
1828 1828

  
1829
/*
1830
 * Replace a value on a deep associative array using regex
1831
 */
1832
function array_replace_values_recursive($data, $match, $replace) {
1833
	if (empty($data))
1834
		return $data;
1835

  
1836
	if (is_string($data))
1837
		$data = preg_replace("/{$match}/", $replace, $data);
1838
	else if (is_array($data))
1839
		foreach ($data as $k => $v)
1840
			$data[$k] = array_replace_values_recursive($v, $match, $replace);
1841

  
1842
	return $data;
1843
}
1844

  
1829 1845
/*
1830 1846
	This function was borrowed from a comment on PHP.net at the following URL:
1831 1847
	http://www.php.net/manual/en/function.array-merge-recursive.php#73843

Also available in: Unified diff