function wfShellExec( $cmd )
{
global $IP;
+
if ( php_uname( 's' ) == 'Linux' ) {
$time = ini_get( 'max_execution_time' );
$mem = ini_get( 'memory_limit' );
if ( $time > 0 && $mem > 0 ) {
- $memKB = intval( $mem / 1024 );
- $cmd = escapeshellarg( "$IP/bin/ulimit.sh" ) . " $time $memKB $cmd";
+ $script = "$IP/bin/ulimit.sh";
+ if ( is_executable( $script ) ) {
+ $memKB = intval( $mem / 1024 );
+ $cmd = escapeshellarg( $script ) . " $time $memKB $cmd";
+ }
}
}
return shell_exec( $cmd );
wfEscapeShellArg( $thumbPath ) ),
$wgSVGConverters[$wgSVGConverter] );
wfDebug( "reallyRenderThumb SVG: $cmd\n" );
- $conv = shell_exec( $cmd );
+ $conv = wfShellExec( $cmd );
} else {
$conv = false;
}
wfEscapeShellArg($this->imagePath) . " -resize {$width}x{$height} " .
wfEscapeShellArg($thumbPath);
wfDebug("reallyRenderThumb: running ImageMagick: $cmd\n");
- $conv = shell_exec( $cmd );
+ $conv = wfShellExec( $cmd );
} else {
# Use PHP's builtin GD library functions.
#