r75472 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75471‎ | r75472 | r75473 >
Date:20:54, 26 October 2010
Author:platonides
Status:ok
Tags:
Comment:
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)
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2487,7 +2487,16 @@
24882488
24892489 wfInitShellLocale();
24902490
2491 - if ( php_uname( 's' ) == 'Linux' ) {
 2491+ if ( wfIsWindows() ) {
 2492+ if ( version_compare( PHP_VERSION, '5.3.0', '<' ) && /* Fixed in 5.3.0 :) */
 2493+ ( version_compare( PHP_VERSION, '5.2.1', '>=' ) || php_uname( 's' ) == 'Windows NT' ) )
 2494+ {
 2495+ # Hack to work around PHP's flawed invocation of cmd.exe
 2496+ # http://news.php.net/php.internals/21796
 2497+ # Windows 9x doesn't accept any kind of quotes
 2498+ $cmd = '"' . $cmd . '"';
 2499+ }
 2500+ } elseif ( php_uname( 's' ) == 'Linux' ) {
24922501 $time = intval( $wgMaxShellTime );
24932502 $mem = intval( $wgMaxShellMemory );
24942503 $filesize = intval( $wgMaxShellFileSize );
@@ -2498,13 +2507,6 @@
24992508 $cmd = '/bin/bash ' . escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd );
25002509 }
25012510 }
2502 - } elseif ( php_uname( 's' ) == 'Windows NT' &&
2503 - version_compare( PHP_VERSION, '5.3.0', '<' ) )
2504 - {
2505 - # This is a hack to work around PHP's flawed invocation of cmd.exe
2506 - # http://news.php.net/php.internals/21796
2507 - # Which is fixed in 5.3.0 :)
2508 - $cmd = '"' . $cmd . '"';
25092511 }
25102512 wfDebug( "wfShellExec: $cmd\n" );
25112513

Status & tagging log