15 $limits[
"memory_limit"] = self::applyLimit(
"memory_limit",
"MEMORY_LIMIT", 64, -1);
37 protected static function applyLimit($phpIniValueName, $dcpParameterName, $defaultValue, $infinityValue = 0)
41 $phpIniLimit = ini_get($phpIniValueName);
42 $changes[
"php.ini"] = $phpIniLimit;
44 if ($infinityValue !== $phpIniLimit) {
45 $changes[
"php.ini_is_infinity"] =
false;
47 $coreLimit = intval(
self::getParam($dcpParameterName, $defaultValue));
48 $changes[
"core"] = $coreLimit;
50 if (self::return_bytes($phpIniLimit) < $coreLimit * 1024 * 1024) {
51 $changes[
"best"] = $coreLimit .
"M";
52 $changes[
"success"] =
false !==ini_set($phpIniValueName, $coreLimit .
"M");
54 $changes[
"best"] = $phpIniLimit;
57 $changes[
"php.ini_is_infinity"] =
true;
58 $changes[
"best"] = $phpIniLimit;
64 protected static function getParam($name, $defaultValue)
66 if(is_null(self::$coreApplication)) {
68 if ($action instanceof \
Action &&
69 "CORE" === $action->parent->name) {
70 self::$coreApplication = $action->parent;
71 return self::$coreApplication->getParam($name, $defaultValue);
73 require_once
'Lib.Common.php';
74 require_once
'Class.ApplicationParameterManager.php';
76 return (null === $parameterValue ? $defaultValue : $parameterValue);
79 return self::$coreApplication->getParam($name, $defaultValue);
92 $last = strtolower(substr($val, -1));
static return_bytes($val)
static getParameterValue($application, $parameterName)
static setCoreApplication(\Application $coreApplication)
getParam($name, $def="")
must be in core or global type
static getParam($name, $defaultValue)
static applyLimit($phpIniValueName, $dcpParameterName, $defaultValue, $infinityValue=0)