// Merge -> revision 9061
This commit is contained in:
@@ -2139,6 +2139,72 @@ FileETag INode MTime Size
|
||||
{
|
||||
$smarty->clearAllCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* getMemoryLimit allow to get the memory limit in octet
|
||||
*
|
||||
* @since 1.4.5.0
|
||||
* @return int the memory limit value in octet
|
||||
*/
|
||||
public static function getMemoryLimit()
|
||||
{
|
||||
$memory_limit = @ini_get('memory_limit');
|
||||
|
||||
if (preg_match('/[0-9]+k/i', $memory_limit))
|
||||
return 1024 * (int)$memory_limit;
|
||||
|
||||
if (preg_match('/[0-9]+m/i', $memory_limit))
|
||||
return 1024 * 1024 * (int)$memory_limit;
|
||||
|
||||
if (preg_match('/[0-9]+g/i', $memory_limit))
|
||||
return 1024 * 1024 * 1024 * (int)$memory_limit;
|
||||
|
||||
return $memory_limit;
|
||||
}
|
||||
|
||||
public static function isX86_64arch()
|
||||
{
|
||||
return (PHP_INT_MAX == '9223372036854775807');
|
||||
}
|
||||
|
||||
/**
|
||||
* apacheModExists return true if the apache module $name is loaded
|
||||
* @TODO move this method in class Information (when it will exist)
|
||||
*
|
||||
* @param string $name module name
|
||||
* @return boolean true if exists
|
||||
* @since 1.4.5.0
|
||||
*/
|
||||
public static function apacheModExists($name)
|
||||
{
|
||||
if(function_exists('apache_get_modules'))
|
||||
{
|
||||
static $apacheModuleList = null;
|
||||
|
||||
if (!is_array($apacheModuleList))
|
||||
$apacheModuleList = apache_get_modules();
|
||||
|
||||
// we need strpos (example can be evasive20
|
||||
foreach($apacheModuleList as $module)
|
||||
{
|
||||
if (strpos($module, $name)!==false)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else{
|
||||
// If apache_get_modules does not exists,
|
||||
// one solution should be parsing httpd.conf,
|
||||
// but we could simple parse phpinfo(INFO_MODULES) return string
|
||||
ob_start();
|
||||
phpinfo(INFO_MODULES);
|
||||
$phpinfo = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if (strpos($phpinfo, $module) !== false)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user