Enh #4026: Check memory limit in prerequisites check

This commit is contained in:
Lucas Bartholemy 2020-04-18 18:47:18 +02:00
parent c746573a8f
commit 7b06ffff6d
2 changed files with 29 additions and 1 deletions

View File

@ -12,6 +12,7 @@ HumHub Change Log
- Fix #4019: Animated Gifs not handled correctly with GMagick extension
- Fix #4021: Activity mail queue job timeout error handling
- Fix #4005: The uploaded logo is scaled too small.
- Enh #4026: Check memory limit in prerequisites check
1.5.0 (April 15, 2020)

View File

@ -318,8 +318,35 @@ class SelfTest
}
$memoryLimit = ini_get('memory_limit');
if (preg_match('/^(\d+)(.)$/', $memoryLimit, $m)) {
if ($m[2] == 'G') {
$memoryLimit = $m[1] * 1024 * 1024 * 1024;
} elseif ($m[2] == 'M') {
$memoryLimit = $m[1] * 1024 * 1024;
} elseif ($m[2] == 'K') {
$memoryLimit = $m[1] * 1024;
}
}
// Check PHP Memory Limit
$title = 'PHP - Memory Limit (64 MB)';
if ($memoryLimit >= 64 * 1024 * 1024) {
$checks[] = [
'title' => Yii::t('base', $title),
'state' => 'OK',
'hint' => 'Current limit is: ' . Yii::$app->formatter->asShortSize($memoryLimit, 0)
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'state' => 'WARNING',
'hint' => 'Increase memory limit in php.ini - Current limit is: ' . Yii::$app->formatter->asShortSize($memoryLimit, 0)
];
}
// Checks LDAP Extension
$title = 'LDAP Support';
$title = 'PHP - LDAP Support';
if (LdapHelper::isLdapAvailable()) {
$checks[] = [