Commit c7cd2606 authored by kiz_0987's avatar kiz_0987

#55834 - fixed php memory test

parent 005a5769
......@@ -185,7 +185,7 @@ class G2EmbedTestUtilities {
function phpMemoryCheck($minimumMemoryLimit = 24) {
$memoryLimit = ini_get('memory_limit');
$title = G2EmbedTestUtilities::_trans('PHP Memory Limit:');
if ($memoryLimit != '' && ($this->_getBytes($memoryLimit) / (1024 * 1024)) < $minimumMemoryLimit) {
if ($memoryLimit != '' && (G2EmbedTestUtilities::_getBytes($memoryLimit) / (1024 * 1024)) < $minimumMemoryLimit) {
$results = array(
'title' => $title,
'error' => true,
......@@ -312,6 +312,27 @@ class G2EmbedTestUtilities {
return $moduleStatus;
}
/*
* Returns the exact bytes value from a php.ini setting
* * Copied from PHP.net's manual entry for ini_get()
*/
function _getBytes($val) {
$val = trim($val);
$last = $val{strlen($val)-1};
switch($last) {
case 'k':
case 'K':
return (int) $val * 1024;
break;
case 'm':
case 'M':
return (int) $val * 1048576;
break;
default:
return $val;
}
}
/**
* Calculate the number of errors and warnings
*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment