Changeset 3246
- Timestamp:
- 11/29/06 21:35:16 (6 years ago)
- Files:
-
- freepbx/trunk/install_amp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
freepbx/trunk/install_amp
r3245 r3246 194 194 case "d": 195 195 out(""); 196 passthru("diff -u ".$file2." ".$file1); 196 // w = ignore whitespace, u = unified 197 passthru("diff -wu ".escapeshellarg($file2)." ".escapeshellarg($file1)); 197 198 break; 198 199 case "s": … … 232 233 } 233 234 235 function checkDiff($file1, $file2) { 236 // diff, ignore whitespace and be quiet 237 exec("diff -wq ".escapeshellarg($file2)." ".escapeshellarg($file1), $output, $retVal); 238 return ($retVal != 0); 239 } 240 234 241 function amp_mkdir($directory, $mode = "0755", $recursive = false) { 235 242 debug("mkdir ".$directory.", ".$mode); … … 297 304 $destination=str_replace("/agi-bin",trim($asterisk_conf["astagidir"]),$destination); 298 305 $destination=str_replace("/sounds",trim($asterisk_conf["astvarlibdir"])."/sounds",$destination); 299 306 300 307 // if this is a directory, ensure destination exists 301 308 if (is_dir($source)) { … … 307 314 } 308 315 316 //var_dump($md5sums); 309 317 if (!is_dir($source)) { 310 if ($check_md5s && file_exists($destination) && isset($md5sums[$destination]) && (md5_file($destination) != $md5sums[$destination])) { 311 $overwrite = ask_overwrite($source, $destination, $md5sums); 318 $md5_source = preg_replace("|^/?amp_conf/|", "/", $source); 319 320 if ($check_md5s && file_exists($destination) && isset($md5sums[$md5_source]) && (md5_file($destination) != $md5sums[$md5_source])) { 321 // double check using diff utility (and ignoring whitespace) 322 // This is a somewhat edge case (eg, the file doesn't match 323 // it's md5 sum from the previous version, but no substantial 324 // changes exist compared to the current version), but it 325 // pervents a useless prompt to the user. 326 if (checkDiff($source, $destination)) { 327 $overwrite = ask_overwrite($source, $destination); 328 } else { 329 debug("NOTE: MD5 for ".$destination." was different, but `diff` did not detect any (non-whitespace) changes: overwriting"); 330 $overwrite = true; 331 } 312 332 } else { 313 333 $overwrite = true;
