From 396a78b3e0f055bfe765fba26f4ec788e53d252f Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Thu, 30 Jun 2005 08:23:32 +0000 Subject: [PATCH] (bug 619) be intelligent about finding the "diff3" executable. firstly, make sure it's GNU diff3, not an incompatible vendor-supplied one. secondly, hardcode several locations where GNU diff3 is likely to be found on at least Solaris and Linux, as well as searching $PATH for both "diff3" and "gdiff3". --- config/index.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/config/index.php b/config/index.php index b24ace8063..6c0a99acec 100644 --- a/config/index.php +++ b/config/index.php @@ -308,6 +308,32 @@ if (!$conf->turck && !$conf->eaccel) { "can't use object caching functions\n"; } +$conf->diff3 = false; +$diff3locations = array("/usr/bin", "/opt/csw/bin", "/usr/gnu/bin", "/usr/sfw/bin") + explode(":", getenv("PATH")); +$diff3names = array("gdiff3", "diff3"); + +function check_location($loc) { + global $diff3names; + + foreach ($diff3names as $name) { + if (file_exists("$loc/$name") && (strstr(`$loc/$name --version 2>&1`, "diff3 (GNU diffutils)") !== false)) + return "$loc/$name"; + } + return false; +} + +foreach ($diff3locations as $loc) { + if (($ok = check_location($loc)) !== false) { + $conf->diff3 = $ok; + break; + } +} + +if ($conf->diff3) + print "
  • Found GNU diff3: $conf->diff3.
  • "; +else + print "
  • GNU diff3 not found.
  • "; + $conf->ImageMagick = false; $imcheck = array( "/usr/bin", "/usr/local/bin", "/sw/bin", "/opt/local/bin" ); foreach( $imcheck as $dir ) { @@ -1160,6 +1186,8 @@ if ( \$wgCommandLineMode ) { \$wgRightsText = \"{$slconf['RightsText']}\"; \$wgRightsIcon = \"{$slconf['RightsIcon']}\"; # \$wgRightsCode = \"{$slconf['RightsCode']}\"; # Not yet used + +\$wgDiff3 = \"{$slconf['diff3']}\"; "; // Keep things in Unix line endings internally; // the system will write out as local text type. -- 2.20.1