Index: trunk/phase3/includes/upload/UploadBase.php |
— | — | @@ -813,11 +813,7 @@ |
814 | 814 | # that does not seem to be worth the pain. |
815 | 815 | # Ask me (Duesentrieb) about it if it's ever needed. |
816 | 816 | $output = array(); |
817 | | - if ( wfIsWindows() ) { |
818 | | - $output = wfRunExternal($command, $exitCode); |
819 | | - } else { |
820 | | - exec( "$command 2>&1", $output, $exitCode ); |
821 | | - } |
| 817 | + $output = wfShellExec($command, $exitCode); |
822 | 818 | |
823 | 819 | |
824 | 820 | # map exit code to AV_xxx constants. |
Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3346,55 +3346,3 @@ |
3347 | 3347 | $langCode = implode ( '-' , $codeBCP ); |
3348 | 3348 | return $langCode; |
3349 | 3349 | } |
3350 | | - |
3351 | | -/* Fixes shell_exec problems on Windows |
3352 | | - * From http://www.php.net/manual/de/function.shell-exec.php#52826 via bug 21140 |
3353 | | - */ |
3354 | | -function wfRunExternal($cmd,&$code) { |
3355 | | - $descriptorspec = array( |
3356 | | - 0 => array("pipe", "r"), // stdin is a pipe that the child will read from |
3357 | | - 1 => array("pipe", "w"), // stdout is a pipe that the child will write to |
3358 | | - 2 => array("pipe", "w") // stderr is a file to write to |
3359 | | - ); |
3360 | | - |
3361 | | - $pipes= array(); |
3362 | | - $process = proc_open($cmd, $descriptorspec, $pipes); |
3363 | | - |
3364 | | - $output= ""; |
3365 | | - |
3366 | | - if (!is_resource($process)) return false; |
3367 | | - |
3368 | | - #close child's input imidiately |
3369 | | - fclose($pipes[0]); |
3370 | | - |
3371 | | - stream_set_blocking($pipes[1],false); |
3372 | | - stream_set_blocking($pipes[2],false); |
3373 | | - |
3374 | | - $todo= array($pipes[1],$pipes[2]); |
3375 | | - |
3376 | | - while( true ) { |
3377 | | - $read= array(); |
3378 | | - if( !feof($pipes[1]) ) $read[]= $pipes[1]; |
3379 | | - if( !feof($pipes[2]) ) $read[]= $pipes[2]; |
3380 | | - |
3381 | | - if (!$read) break; |
3382 | | - |
3383 | | - $ready= stream_select($read, $write=NULL, $ex= NULL, 2); |
3384 | | - |
3385 | | - if ($ready === false) { |
3386 | | - break; #should never happen - something died |
3387 | | - } |
3388 | | - |
3389 | | - foreach ($read as $r) { |
3390 | | - $s= fread($r,1024); |
3391 | | - $output.= $s; |
3392 | | - } |
3393 | | - } |
3394 | | - |
3395 | | - fclose($pipes[1]); |
3396 | | - fclose($pipes[2]); |
3397 | | - |
3398 | | - $code= proc_close($process); |
3399 | | - |
3400 | | - return $output; |
3401 | | -} |