Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -2101,11 +2101,26 @@ |
2102 | 2102 | function wfShellExec( $cmd, &$retval=null ) { |
2103 | 2103 | global $IP, $wgMaxShellMemory, $wgMaxShellFileSize, $wgMaxShellTime; |
2104 | 2104 | |
2105 | | - if( wfIniGetBool( 'safe_mode' ) ) { |
2106 | | - wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" ); |
| 2105 | + static $disabled; |
| 2106 | + if ( is_null( $disabled ) ) { |
| 2107 | + $disabled = false; |
| 2108 | + if( wfIniGetBool( 'safe_mode' ) ) { |
| 2109 | + wfDebug( "wfShellExec can't run in safe_mode, PHP's exec functions are too broken.\n" ); |
| 2110 | + $disabled = true; |
| 2111 | + } |
| 2112 | + $functions = explode( ',', ini_get( 'disable_functions' ) ); |
| 2113 | + $functions = array_map( 'trim', $functions ); |
| 2114 | + $functions = array_map( 'strtolower', $functions ); |
| 2115 | + if ( in_array( 'passthru', $functions ) ) { |
| 2116 | + wfDebug( "passthru is in disabled_functions\n" ); |
| 2117 | + $disabled = true; |
| 2118 | + } |
| 2119 | + } |
| 2120 | + if ( $disabled ) { |
2107 | 2121 | $retval = 1; |
2108 | 2122 | return "Unable to run external programs in safe mode."; |
2109 | 2123 | } |
| 2124 | + |
2110 | 2125 | wfInitShellLocale(); |
2111 | 2126 | |
2112 | 2127 | if ( php_uname( 's' ) == 'Linux' ) { |