Edit File by line
/home/barbar84/www/wp-conte.../plugins/updraftp.../vendor/symfony/process
File: ExecutableFinder.php
<?php
[0] Fix | Delete
[1] Fix | Delete
/*
[2] Fix | Delete
* This file is part of the Symfony package.
[3] Fix | Delete
*
[4] Fix | Delete
* (c) Fabien Potencier <fabien@symfony.com>
[5] Fix | Delete
*
[6] Fix | Delete
* For the full copyright and license information, please view the LICENSE
[7] Fix | Delete
* file that was distributed with this source code.
[8] Fix | Delete
*/
[9] Fix | Delete
[10] Fix | Delete
namespace Symfony\Component\Process;
[11] Fix | Delete
[12] Fix | Delete
/**
[13] Fix | Delete
* Generic executable finder.
[14] Fix | Delete
*
[15] Fix | Delete
* @author Fabien Potencier <fabien@symfony.com>
[16] Fix | Delete
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
[17] Fix | Delete
*/
[18] Fix | Delete
class ExecutableFinder
[19] Fix | Delete
{
[20] Fix | Delete
private $suffixes = ['.exe', '.bat', '.cmd', '.com'];
[21] Fix | Delete
[22] Fix | Delete
/**
[23] Fix | Delete
* Replaces default suffixes of executable.
[24] Fix | Delete
*/
[25] Fix | Delete
public function setSuffixes(array $suffixes)
[26] Fix | Delete
{
[27] Fix | Delete
$this->suffixes = $suffixes;
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
/**
[31] Fix | Delete
* Adds new possible suffix to check for executable.
[32] Fix | Delete
*
[33] Fix | Delete
* @param string $suffix
[34] Fix | Delete
*/
[35] Fix | Delete
public function addSuffix($suffix)
[36] Fix | Delete
{
[37] Fix | Delete
$this->suffixes[] = $suffix;
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
/**
[41] Fix | Delete
* Finds an executable by name.
[42] Fix | Delete
*
[43] Fix | Delete
* @param string $name The executable name (without the extension)
[44] Fix | Delete
* @param string|null $default The default to return if no executable is found
[45] Fix | Delete
* @param array $extraDirs Additional dirs to check into
[46] Fix | Delete
*
[47] Fix | Delete
* @return string|null The executable path or default value
[48] Fix | Delete
*/
[49] Fix | Delete
public function find($name, $default = null, array $extraDirs = [])
[50] Fix | Delete
{
[51] Fix | Delete
if (ini_get('open_basedir')) {
[52] Fix | Delete
$searchPath = array_merge(explode(\PATH_SEPARATOR, ini_get('open_basedir')), $extraDirs);
[53] Fix | Delete
$dirs = [];
[54] Fix | Delete
foreach ($searchPath as $path) {
[55] Fix | Delete
// Silencing against https://bugs.php.net/69240
[56] Fix | Delete
if (@is_dir($path)) {
[57] Fix | Delete
$dirs[] = $path;
[58] Fix | Delete
} else {
[59] Fix | Delete
if (basename($path) == $name && @is_executable($path)) {
[60] Fix | Delete
return $path;
[61] Fix | Delete
}
[62] Fix | Delete
}
[63] Fix | Delete
}
[64] Fix | Delete
} else {
[65] Fix | Delete
$dirs = array_merge(
[66] Fix | Delete
explode(\PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
[67] Fix | Delete
$extraDirs
[68] Fix | Delete
);
[69] Fix | Delete
}
[70] Fix | Delete
[71] Fix | Delete
$suffixes = [''];
[72] Fix | Delete
if ('\\' === \DIRECTORY_SEPARATOR) {
[73] Fix | Delete
$pathExt = getenv('PATHEXT');
[74] Fix | Delete
$suffixes = array_merge($pathExt ? explode(\PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
[75] Fix | Delete
}
[76] Fix | Delete
foreach ($suffixes as $suffix) {
[77] Fix | Delete
foreach ($dirs as $dir) {
[78] Fix | Delete
if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
[79] Fix | Delete
return $file;
[80] Fix | Delete
}
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
return $default;
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function