119 public static function command( ...$commands ) {
120 if ( count( $commands ) === 1 && is_array( reset( $commands ) ) ) {
123 $commands = reset( $commands );
126 ->getShellCommandFactory()
129 return $command->params( $commands );
138 static $disabled =
null;
140 if ( is_null( $disabled ) ) {
141 if ( !function_exists(
'proc_open' ) ) {
142 wfDebug(
"proc_open() is disabled\n" );
164 if ( count(
$args ) === 1 && is_array( reset(
$args ) ) ) {
172 foreach (
$args as $arg ) {
173 if ( $arg ===
null ) {
190 $tokens = preg_split(
'/(\\\\*")/', $arg, -1, PREG_SPLIT_DELIM_CAPTURE );
193 foreach (
$tokens as $token ) {
194 if ( $iteration % 2 == 1 ) {
196 $arg .= str_replace(
'\\',
'\\\\', substr( $token, 0, -1 ) ) .
'\\"';
197 } elseif ( $iteration % 4 == 2 ) {
199 $arg .= str_replace(
'^',
'^^', $token );
209 if ( preg_match(
'/^(.*?)(\\\\+)$/', $arg, $m ) ) {
210 $arg = $m[1] . str_replace(
'\\',
'\\\\', $m[2] );
214 $retVal .=
'"' . $arg .
'"';
216 $retVal .= escapeshellarg( $arg );
239 Hooks::run(
'wfShellWikiCmd', [ &$script, &$parameters, &
$options ] );
241 if ( isset(
$options[
'wrapper'] ) ) {
247 ->params( $parameters )
248 ->restrict( self::RESTRICT_DEFAULT & ~self::NO_LOCALSETTINGS );
$wgPhpCli
Executable path of the PHP cli binary.
wfDebug( $text, $dest='all', array $context=[])
Sends a line to the debug log if enabled or, optionally, to a comment in output.
wfIsWindows()
Check if the operating system is Windows.
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options