Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2487,7 +2487,16 @@ |
2488 | 2488 | |
2489 | 2489 | wfInitShellLocale(); |
2490 | 2490 | |
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' ) { |
2492 | 2501 | $time = intval( $wgMaxShellTime ); |
2493 | 2502 | $mem = intval( $wgMaxShellMemory ); |
2494 | 2503 | $filesize = intval( $wgMaxShellFileSize ); |
— | — | @@ -2498,13 +2507,6 @@ |
2499 | 2508 | $cmd = '/bin/bash ' . escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd ); |
2500 | 2509 | } |
2501 | 2510 | } |
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 . '"'; |
2509 | 2511 | } |
2510 | 2512 | wfDebug( "wfShellExec: $cmd\n" ); |
2511 | 2513 | |