Commit c7cd2606 authored by kiz_0987's avatar kiz_0987
Browse files

#55834 - fixed php memory test

parent 005a5769
...@@ -185,7 +185,7 @@ class G2EmbedTestUtilities { ...@@ -185,7 +185,7 @@ class G2EmbedTestUtilities {
function phpMemoryCheck($minimumMemoryLimit = 24) { function phpMemoryCheck($minimumMemoryLimit = 24) {
$memoryLimit = ini_get('memory_limit'); $memoryLimit = ini_get('memory_limit');
$title = G2EmbedTestUtilities::_trans('PHP 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( $results = array(
'title' => $title, 'title' => $title,
'error' => true, 'error' => true,
...@@ -312,6 +312,27 @@ class G2EmbedTestUtilities { ...@@ -312,6 +312,27 @@ class G2EmbedTestUtilities {
return $moduleStatus; 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 * 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