Diff properties files

Do you want to find updates in properties files after a new release of an alfresco-like java application? Just see following example script to diff two properties files and show differences…

list_missing_properties.php:

/**
 * Quick sample code to diff two properties files after update
 * see more @ http://louise.hu
 * 
 * Usage:
 * 	php list_missing_properties.php "file1.properties" "file2.properties" 
 * 
 * 
 * @author LouiSe@louise.hu
 */

$ppp = null;

$diff = propertiesDiff($argv[1], $argv[2]);
echo "Properties missing in \"".$argv[2]."\":\n\n";
foreach ($diff as $key => $value){
	echo $value."=".$ppp[$value]."\n";
}
echo "\n\n";

$diff = propertiesDiff($argv[2], $argv[1]);
echo "Properties missing in \"".$argv[1]."\":\n\n";
foreach ($diff as $key => $value){
	echo $value."=".$ppp[$value]."\n";
}
echo "\n";

function getAllPropertyNames($propArray) {
	
	$propertyNames = array();
	
	for($i=0;$i

Leave a Reply

Your email address will not be published. Required fields are marked *