MediaWiki REL1_40
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.
 

Static Protected Member Functions

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

Detailed Description

Utility class to find executables in likely places.

Since
1.31

Definition at line 29 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 63 of file ExecutableFinder.php.

References $path.

◆ 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 97 of file ExecutableFinder.php.

References $path.

Referenced by MediaWiki\Shell\CommandFactory\findFirejail().

◆ 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 38 of file ExecutableFinder.php.


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