MediaWiki  1.33.0
ExecutableFinder Class Reference

Utility class to find executables in likely places. More...

Static Public Member Functions

static findInDefaultPaths ( $names, $versionInfo=false)
 Same as locateExecutable(), but checks in getPossibleBinPaths() by default. More...
 

Static Protected Member Functions

static findExecutable ( $path, $name, $versionInfo=false)
 Search a path for any of the given executable names. More...
 
static getPossibleBinPaths ()
 Get an array of likely places we can find executables. More...
 

Detailed Description

Utility class to find executables in likely places.

Since
1.31

Definition at line 28 of file ExecutableFinder.php.

Member Function Documentation

◆ findExecutable()

static ExecutableFinder::findExecutable (   $path,
  $name,
  $versionInfo = false 
)
staticprotected

Search a path for any of the given executable names.

Returns the executable name if found. Also checks the version string returned by each executable.

Used only by environment checks.

Parameters
string$pathPath to search
string$nameExecutable name to look for
array | bool$versionInfoFalse or array with two members: 0 => Parameter to pass to binary for version check (e.g. –version) 1 => String to compare the output with

If $versionInfo is not false, only executables with a version matching $versionInfo[1] will be returned.

Returns
bool|string

Definition at line 62 of file ExecutableFinder.php.

References $command, $name, $output, and $path.

Referenced by findInDefaultPaths().

◆ findInDefaultPaths()

static ExecutableFinder::findInDefaultPaths (   $names,
  $versionInfo = false 
)
static

Same as locateExecutable(), but checks in getPossibleBinPaths() by default.

See also
locateExecutable()
Parameters
string | string[]$namesArray of possible names.
array | bool$versionInfoDefault: false or array with two members: 0 => Parameter to run for version check, e.g. '–version' 1 => String to compare the output with

If $versionInfo is not false, only executables with a version matching $versionInfo[1] will be returned.

Returns
bool|string

Definition at line 96 of file ExecutableFinder.php.

References $name, $path, array(), as, findExecutable(), and getPossibleBinPaths().

Referenced by MediaWiki\Tests\Maintenance\DumpTestCase\checkHasGzip(), Installer\envCheckDiff3(), Installer\envCheckGit(), Installer\envCheckGraphics(), MediaWiki\Shell\CommandFactory\findFirejail(), and Maintenance\readlineEmulation().

◆ getPossibleBinPaths()

static ExecutableFinder::getPossibleBinPaths ( )
staticprotected

Get an array of likely places we can find executables.

Check a bunch of known Unix-like defaults, as well as the PATH environment variable (which should maybe make it work for Windows?)

Returns
array

Definition at line 37 of file ExecutableFinder.php.

Referenced by findInDefaultPaths().


The documentation for this class was generated from the following file: