Index: trunk/phase3/includes/GlobalFunctions.php |
— | — | @@ -3195,11 +3195,16 @@ |
3196 | 3196 | |
3197 | 3197 | /* Parse PHP's silly format for memory limits */ |
3198 | 3198 | function wfParseMemoryLimit( $memlimit ) { |
3199 | | - $n = intval( $memlimit ); |
3200 | | - if( preg_match( '/^([0-9]+)[Mm]$/', trim( $memlimit ), $m ) ) { |
3201 | | - $n = intval( $m[1] * (1024*1024) ); |
3202 | | - } |
3203 | | - return $n; |
| 3199 | + $last = strtolower($memlimit[strlen($memlimit)-1]); |
| 3200 | + $val = intval( $memlimit ); |
| 3201 | + switch($last) { |
| 3202 | + case 'g': |
| 3203 | + $val *= 1024; |
| 3204 | + case 'm': |
| 3205 | + $val *= 1024; |
| 3206 | + case 'k': |
| 3207 | + $val *= 1024; |
| 3208 | + return $val; |
3204 | 3209 | } |
3205 | 3210 | |
3206 | 3211 | /* Get the normalised IETF language tag |