diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/common.php | 27 | ||||
-rw-r--r-- | inc/infoutils.php | 14 |
2 files changed, 41 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php index 00cde2e92..ce32e42cb 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1135,4 +1135,31 @@ function unslash($string,$char="'"){ return str_replace('\\'.$char,$char,$string); } +/** + * Convert php.ini shorthands to byte + * + * @author <gilthans dot NO dot SPAM at gmail dot com> + * @link http://de3.php.net/manual/en/ini.core.php#79564 + */ +function php_to_byte($v){ + $l = substr($v, -1); + $ret = substr($v, 0, -1); + switch(strtoupper($l)){ + case 'P': + $ret *= 1024; + case 'T': + $ret *= 1024; + case 'G': + $ret *= 1024; + case 'M': + $ret *= 1024; + case 'K': + $ret *= 1024; + break; + } + return $ret; +} + + + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/infoutils.php b/inc/infoutils.php index bc162d0e7..1fc55702e 100644 --- a/inc/infoutils.php +++ b/inc/infoutils.php @@ -89,6 +89,20 @@ function check(){ msg('PHP version '.phpversion(),1); } + $mem = (int) php_to_byte(ini_get('memory_limit')); + if($mem){ + if($mem < 16777216){ + msg('PHP is limited to less than 16MB RAM ('.$mem.' bytes). Increase memory_limit in php.ini',-1); + }elseif($mem < 20971520){ + msg('PHP is limited to less than 20MB RAM ('.$mem.' bytes), you might encounter problems with bigger pages. Increase memory_limit in php.ini',-1); + }elseif($mem < 33554432){ + msg('PHP is limited to less than 32MB RAM ('.$mem.' bytes), but that should be enough in most cases. If not, increase memory_limit in php.ini',0); + }else{ + msg('More than 32MB RAM ('.$mem.' bytes) available.',1); + } + } + + if(is_writable($conf['changelog'])){ msg('Changelog is writable',1); }else{ |