* Fix ulimit parameters for wfShellExec when memory_limit is specified in 'm'
authorBrion Vibber <brion@users.mediawiki.org>
Sat, 26 Nov 2005 20:17:43 +0000 (20:17 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sat, 26 Nov 2005 20:17:43 +0000 (20:17 +0000)
With memory_limit of '50M', it got automatically turned into '50' in a
numeric context, which ended up passing *zero* kilobytes for ulimit.
This would make nothing able to run on Linux, things would just segfault.

RELEASE-NOTES
includes/GlobalFunctions.php

index 76fc7fc..9aa1e9b 100644 (file)
@@ -254,6 +254,8 @@ fully support the editing toolbar, but was found to be too confusing.
 * Changed mail form to have a bigger message entry box (like for editing
   a page
 * Support <includeonly> in templates loaded through preload= parameter
+* Fix ulimit parameters for wfShellExec when memory_limit is specified in 'm'
+
 
 === Caveats ===
 
index d97740e..72d0d80 100644 (file)
@@ -1588,6 +1588,9 @@ function wfShellExec( $cmd )
        if ( php_uname( 's' ) == 'Linux' ) {
                $time = ini_get( 'max_execution_time' );
                $mem = ini_get( 'memory_limit' );
+               if( preg_match( '/^([0-9]+)[Mm]$/', trim( $mem ), $m ) ) {
+                       $mem = intval( $m[1] * (1024*1024) );
+               }
                if ( $time > 0 && $mem > 0 ) {
                        $script = "$IP/bin/ulimit.sh";
                        if ( is_executable( $script ) ) {