use wcf\system\setup\Installer;
use wcf\system\setup\SetupFileHandler;
use wcf\system\template\SetupTemplateEngine;
+use wcf\util\FileUtil;
use wcf\util\HeaderUtil;
use wcf\util\StringUtil;
use wcf\util\UserUtil;
}
// memory limit
- $system['memoryLimit']['value'] = \ini_get('memory_limit');
- $system['memoryLimit']['result'] = $this->compareMemoryLimit();
+ $system['memoryLimit']['value'] = FileUtil::getMemoryLimit();
+ $system['memoryLimit']['result'] = $system['memoryLimit']['value'] === -1 || $system['memoryLimit']['value'] >= 128 * 1024 * 1024;
// openssl extension
$system['openssl']['result'] = \extension_loaded('openssl');
return $this->gotoNextStep('configureDB');
}
- /**
- * Returns true if memory_limit is set to at least 128 MB
- */
- protected function compareMemoryLimit(): bool
- {
- $memoryLimit = \ini_get('memory_limit');
-
- // no limit
- if ($memoryLimit == -1) {
- return true;
- }
-
- // completely numeric, PHP assumes byte
- if (\is_numeric($memoryLimit)) {
- $memoryLimit = $memoryLimit / 1024 / 1024;
-
- return $memoryLimit >= 128;
- }
-
- // PHP supports 'K', 'M' and 'G' shorthand notation
- if (\preg_match('~^(\d+)([KMG])$~', $memoryLimit, $matches)) {
- switch ($matches[2]) {
- case 'K':
- $memoryLimit = $matches[1] * 1024;
-
- return $memoryLimit >= 128;
-
- case 'M':
- return $matches[1] >= 128;
-
- case 'G':
- return $matches[1] >= 1;
- }
- }
-
- return false;
- }
-
/**
* Shows the page for configuring the database connection.
*/
<div class="row rowColGap formGrid">
<dl class="col-xs-12 col-md-6">
<dt>{lang}wcf.global.systemRequirements.element.required{/lang}</dt>
- <dd>128M</dd>
+ <dd>128 MiB</dd>
</dl>
<dl class="col-xs-12 col-md-6">
<dt>{lang}wcf.global.systemRequirements.element.yours{/lang}</dt>
<dd>
- <span class="badge {if !$system.memoryLimit.result}red{else}green{/if}">{$system.memoryLimit.value}</span>
+ <span class="badge {if !$system.memoryLimit.result}red{else}green{/if}">{$system.memoryLimit.value|filesizeBinary}</span>
{if !$system.memoryLimit.result}<small>{lang}wcf.global.systemRequirements.memoryLimit.description{/lang}</small>{/if}
</dd>
</dl>