[Process] Clean-up/simplify code

This commit is contained in:
Jordi Boggiano 2012-07-03 18:19:31 +02:00
parent 56f473a073
commit 28e1313e5d
2 changed files with 8 additions and 9 deletions

View File

@ -71,7 +71,11 @@ class ExecutableFinder
);
}
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : $this->suffixes) : array('');
$suffixes = array('');
if (defined('PHP_WINDOWS_VERSION_BUILD')) {
$pathExt = getenv('PATHEXT');
$suffixes = $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes;
}
foreach ($suffixes as $suffix) {
foreach ($dirs as $dir) {
if (is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && (self::$isWindows || is_executable($file))) {

View File

@ -46,19 +46,14 @@ class PhpExecutableFinder
return $php;
}
$suffixes = DIRECTORY_SEPARATOR == '\\' ? (getenv('PATHEXT') ? explode(PATH_SEPARATOR, getenv('PATHEXT')) : array('.exe', '.bat', '.cmd', '.com')) : array('');
foreach ($suffixes as $suffix) {
if (is_executable($php = PHP_BINDIR.DIRECTORY_SEPARATOR.'php'.$suffix)) {
return $php;
}
}
if ($php = getenv('PHP_PEAR_PHP_BIN')) {
if (is_executable($php)) {
return $php;
}
}
return $this->executableFinder->find('php');
$dirs = array(PHP_BINDIR);
return $this->executableFinder->find('php', false, $dirs);
}
}