From 6408312bb3e18692bafae95321235f91f99ec1bb Mon Sep 17 00:00:00 2001 From: Platonides Date: Tue, 26 Oct 2010 20:54:29 +0000 Subject: [PATCH] Reorder to shortcut some more php_uname() calls. Note that PHP 5.2.1 can't run on Windows 9x since it wouldn't be able to link with the GetBinaryType() function (added in PHP r225464) --- includes/GlobalFunctions.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index acbde8fceb..12464e6c05 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -2487,7 +2487,16 @@ function wfShellExec( $cmd, &$retval = null ) { wfInitShellLocale(); - if ( php_uname( 's' ) == 'Linux' ) { + if ( wfIsWindows() ) { + if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && /* Fixed in 5.3.0 :) */ + ( version_compare( PHP_VERSION, '5.2.1', '>=' ) || php_uname( 's' ) == 'Windows NT' ) ) + { + # Hack to work around PHP's flawed invocation of cmd.exe + # http://news.php.net/php.internals/21796 + # Windows 9x doesn't accept any kind of quotes + $cmd = '"' . $cmd . '"'; + } + } elseif ( php_uname( 's' ) == 'Linux' ) { $time = intval( $wgMaxShellTime ); $mem = intval( $wgMaxShellMemory ); $filesize = intval( $wgMaxShellFileSize ); @@ -2498,13 +2507,6 @@ function wfShellExec( $cmd, &$retval = null ) { $cmd = '/bin/bash ' . escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd ); } } - } elseif ( php_uname( 's' ) == 'Windows NT' && - version_compare( PHP_VERSION, '5.3.0', '<' ) ) - { - # This is a hack to work around PHP's flawed invocation of cmd.exe - # http://news.php.net/php.internals/21796 - # Which is fixed in 5.3.0 :) - $cmd = '"' . $cmd . '"'; } wfDebug( "wfShellExec: $cmd\n" ); -- 2.20.1