MediaWiki
1.30.0
|
Executes shell commands. More...
Static Public Member Functions | |
static | command ( $command) |
Returns a new instance of Command class. More... | |
static | escape () |
Version of escapeshellarg() that works better on Windows. More... | |
static | isDisabled () |
Check if this class is effectively disabled via php.ini config. More... | |
Executes shell commands.
Use call chaining with this class for expressiveness: $result = Shell::command( 'some command' ) ->environment( [ 'ENVIRONMENT_VARIABLE' => 'VALUE' ] ) ->limits( [ 'time' => 300 ] ) ->execute();
... = $result->getExitCode(); ... = $result->getStdout();
|
static |
Returns a new instance of Command class.
string | string[] | $command | String or array of strings representing the command to be executed, each value will be escaped. Example: [ 'convert', '-font', 'font name' ] would produce "'convert' '-font' 'font name'" |
Definition at line 51 of file Shell.php.
References $args, $command, captcha-old\count, and MediaWiki\MediaWikiServices\getInstance().
|
static |
Version of escapeshellarg() that works better on Windows.
Originally, this fixed the incorrect use of single quotes on Windows (https://bugs.php.net/bug.php?id=26285) and the locale problems on Linux in PHP 5.2.6+ (bug backported to earlier distro releases of PHP).
string | $args,... | strings to escape and glue together, or a single array of strings parameter. Null values are ignored. |
Definition at line 96 of file Shell.php.
References $args, $tokens, as, captcha-old\count, and wfIsWindows().
Referenced by MediaWiki\Shell\Command\params().
|
static |
Check if this class is effectively disabled via php.ini config.
Definition at line 70 of file Shell.php.
References wfDebug().
Referenced by MediaWiki\Shell\Command\__construct().