From: Platonides Date: Tue, 26 Oct 2010 20:54:29 +0000 (+0000) Subject: Reorder to shortcut some more php_uname() calls. X-Git-Tag: 1.31.0-rc.0~34288 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22articles%22%2C%22id_article=%24id_article%22%29%20.%20%22?a=commitdiff_plain;h=6408312bb3e18692bafae95321235f91f99ec1bb;p=lhc%2Fweb%2Fwiklou.git 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) --- 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" );