Fixing pear on windows for 4.3.0 release
| From: | Edin Kadribasic | Date: | Sat, 21 Dec 2002 23:16:56 +0000 |
| Subject: | Fixing pear on windows for 4.3.0 release | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-11788@lists.php.net to get a copy of this message | ||
The following patch makes pear work on windows again. The problem is that
is_executable() is not available on windows. Stig, could you update PEAR
package since I would like to confirm that go-pear works on windows before
4.3.0 is released, and that is *real* soon now.
Edin
Index: System.php =================================================================== RCS file: /repository/php4/pear/System.php,v retrieving revision 1.21.2.1 diff -u -r1.21.2.1 System.php --- System.php 13 Dec 2002 02:14:22 -0000 1.21.2.1 +++ System.php 21 Dec 2002 23:13:19 -0000 @@ -419,17 +419,25 @@ */ function which($program, $fallback = false) { + // is_executable() is not available on windows + if (OS_WINDOWS) { + $pear_is_executable = 'is_file'; + } else { + $pear_is_executable = 'is_executable'; + } + // full path given if (basename($program) != $program) { - return (@is_executable($program)) ? $program : $fallback; + return (@$pear_is_executable($program)) ? $program : $fallback; } + // XXX FIXME honor safe mode $path_delim = OS_WINDOWS ? ';' : ':'; $exe_suffix = OS_WINDOWS ? '.exe' : ''; $path_elements = explode($path_delim, getenv('PATH')); foreach ($path_elements as $dir) { $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix; - if (@is_file($file) && @is_executable($file)) { + if (@is_file($file) && @$pear_is_executable($file)) { return $file; } }
Index: System.php =================================================================== RCS file: /repository/php4/pear/System.php,v retrieving revision 1.21.2.1 diff -u -r1.21.2.1 System.php --- System.php 13 Dec 2002 02:14:22 -0000 1.21.2.1 +++ System.php 21 Dec 2002 23:13:19 -0000 @@ -419,17 +419,25 @@ */ function which($program, $fallback = false) { + // is_executable() is not available on windows + if (OS_WINDOWS) { + $pear_is_executable = 'is_file'; + } else { + $pear_is_executable = 'is_executable'; + } + // full path given if (basename($program) != $program) { - return (@is_executable($program)) ? $program : $fallback; + return (@$pear_is_executable($program)) ? $program : $fallback; } + // XXX FIXME honor safe mode $path_delim = OS_WINDOWS ? ';' : ':'; $exe_suffix = OS_WINDOWS ? '.exe' : ''; $path_elements = explode($path_delim, getenv('PATH')); foreach ($path_elements as $dir) { $file = $dir . DIRECTORY_SEPARATOR . $program . $exe_suffix; - if (@is_file($file) && @is_executable($file)) { + if (@is_file($file) && @$pear_is_executable($file)) { return $file; } }