The function wfShorthandToInteger() is precisely for that.
authorPlatonides <platonides@users.mediawiki.org>
Tue, 25 Jan 2011 22:42:53 +0000 (22:42 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 25 Jan 2011 22:42:53 +0000 (22:42 +0000)
The previous way only worked for megabytes, which made it
'raise' the memory limit from several gigabytes to 50M

includes/installer/Installer.php

index c33606c..507ba2e 100644 (file)
@@ -748,11 +748,7 @@ abstract class Installer {
                        return true;
                }
 
-               $n = intval( $limit );
-
-               if( preg_match( '/^([0-9]+)[Mm]$/', trim( $limit ), $m ) ) {
-                       $n = intval( $m[1] * ( 1024 * 1024 ) );
-               }
+               $n = wfShorthandToInteger( $limit );
 
                if( $n < $this->minMemorySize * 1024 * 1024 ) {
                        $newLimit = "{$this->minMemorySize}M";