Fix Prerequisites / Self Test translations (#5154)

* Fix Prerequisites / Self Test translations

* Change category of translatable strings in Prerequisites

Co-authored-by: Lucas Bartholemy <luke-@users.noreply.github.com>
This commit is contained in:
Yuriy Bakhtin 2021-07-08 16:05:58 +03:00 committed by GitHub
parent 8eb642da09
commit e2319b3aab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 162 additions and 167 deletions

View File

@ -7,6 +7,7 @@
- Fix #5137: Fix convert to short integer on PHP 8
- Enh #5144: Show sort order in profile fields settings
- Fix #5149: Use a link mode for space button "Join" from space header
- Fix #4830: Fix Prerequisites / Self Test translations
- Fix #4459: Make UserFollow activity public

View File

@ -42,278 +42,273 @@ class SelfTest
$checks = [];
// Checks PHP Version
$title = 'PHP - Version - ' . PHP_VERSION;
$title = 'PHP - ' . Yii::t('AdminModule.information', 'Version') . ' - ' . PHP_VERSION;
if (version_compare(PHP_VERSION, '7.3', '>=')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} elseif (version_compare(PHP_VERSION, '7.2', '>=')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Minimum Version 7.3'
'hint' => Yii::t('AdminModule.information', 'Minimum Version {minVersion}', ['minVersion' => '7.3'])
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Minimum Version 7.3'
'hint' => Yii::t('AdminModule.information', 'Minimum Version {minVersion}', ['minVersion' => '7.3'])
];
}
// Checks GD Extension
$title = 'PHP - GD Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'GD']);
if (function_exists('gd_info')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install GD Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'GD'])
];
}
// Checks GD JPEG Extension
$title = 'PHP - GD Extension - JPEG Support';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'GD'])
. ' - ' . Yii::t('AdminModule.information', '{imageExtension} Support', ['imageExtension' => 'JPEG']);
if (function_exists('imageCreateFromJpeg')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install GD Extension - JPEG Support'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'GD'])
. ' - ' . Yii::t('AdminModule.information', '{imageExtension} Support', ['imageExtension' => 'JPEG'])
];
}
// Checks GD PNG Extension
$title = 'PHP - GD Extension - PNG Support';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'GD'])
. ' - ' . Yii::t('AdminModule.information', '{imageExtension} Support', ['imageExtension' => 'PNG']);
if (function_exists('imageCreateFromPng')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install GD Extension - PNG Support'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'GD'])
. ' - ' . Yii::t('AdminModule.information', '{imageExtension} Support', ['imageExtension' => 'PNG'])
];
}
// Checks INTL Extension
$title = 'PHP - INTL Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'INTL']);
if (function_exists('collator_create')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install INTL Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'INTL'])
];
}
$icuVersion = (defined('INTL_ICU_VERSION')) ? INTL_ICU_VERSION : 0;
// Check ICU Version
$icuVersion = defined('INTL_ICU_VERSION') ? INTL_ICU_VERSION : 0;
$icuMinVersion = '4.8.1';
$title = 'PHP - INTL Extension - ICU Version (' . $icuVersion . ')';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'INTL'])
. ' - ' . Yii::t('AdminModule.information', 'ICU Version ({version})', ['version' => $icuVersion]);
if (version_compare($icuVersion, $icuMinVersion, '>=')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'ICU Data ' . $icuMinVersion . ' or higher is required'
'hint' => Yii::t('AdminModule.information', 'ICU {icuMinVersion} or higher is required', ['icuMinVersion' => $icuMinVersion])
];
}
// Check ICU Data Version
$icuDataVersion = (defined('INTL_ICU_DATA_VERSION')) ? INTL_ICU_DATA_VERSION : 0;
$icuMinDataVersion = '4.8.1';
$title = 'PHP - INTL Extension - ICU Data Version (' . $icuDataVersion . ')';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'INTL'])
. ' - ' . Yii::t('AdminModule.information', 'ICU Data Version ({version})', ['version' => $icuDataVersion]);
if (version_compare($icuDataVersion, $icuMinDataVersion, '>=')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'ICU Data ' . $icuMinDataVersion . ' or higher is required'
'hint' => Yii::t('AdminModule.information', 'ICU Data {icuMinVersion} or higher is required', ['icuMinDataVersion' => $icuMinDataVersion])
];
}
// Checks EXIF Extension
$title = 'PHP - EXIF Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'EXIF']);
if (function_exists('exif_read_data')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install EXIF Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'EXIF'])
];
}
// Checks XML Extension
$title = 'PHP - XML Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'XML']);
if (function_exists('libxml_get_errors')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Install XML Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'XML'])
];
}
// Check FileInfo Extension
$title = 'PHP - FileInfo Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'FileInfo']);
if (extension_loaded('fileinfo')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install FileInfo Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'FileInfo'])
];
}
// Checks Multibyte Extension
$title = 'PHP - Multibyte String Functions';
$title = 'PHP - ' . Yii::t('AdminModule.information', 'Multibyte String Functions');
if (function_exists('mb_substr')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install PHP Multibyte Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PHP Multibyte'])
];
}
// Checks iconv Extension
$title = 'PHP - iconv Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'iconv']);
if (function_exists('iconv_strlen')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install PHP iconv Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PHP iconv'])
];
}
// Checks cURL Extension
$title = 'PHP - cURL Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'cURL']);
if (function_exists('curl_version')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install Curl Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'Curl'])
];
}
// Checks ZIP Extension
$title = 'PHP - ZIP Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'ZIP']);
if (class_exists('ZipArchive')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install PHP ZIP Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PHP ZIP'])
];
}
// Checks OpenSSL Extension
$title = 'PHP - OpenSSL Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'OpenSSL']);
if (function_exists('openssl_encrypt')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional - Install OpenSSL Extension for e-mail S/MIME support.'
'hint' => Yii::t('AdminModule.information', 'Optional') . ' - '
. Yii::t('AdminModule.information', 'Install {phpExtension} Extension for e-mail S/MIME support.', ['phpExtension' => 'OpenSSL'])
];
}
// Checks ImageMagick Extension
$title = 'PHP - ImageMagick Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'ImageMagick']);
if (class_exists('Imagick', false)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional'
'hint' => Yii::t('AdminModule.information', 'Optional')
];
}
// Checks GraphicsMagick Extension
$title = 'PHP - GraphicsMagick Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'GraphicsMagick']);
if (class_exists('Gmagick', false)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional'
'hint' => Yii::t('AdminModule.information', 'Optional')
];
}
@ -330,83 +325,83 @@ class SelfTest
}
// Check PHP Memory Limit
$title = 'PHP - Memory Limit (64 MB)';
$title = 'PHP - ' . Yii::t('AdminModule.information', 'Memory Limit ({memoryLimit})', ['memoryLimit' => '64 MB']);
$currentLimitHint = Yii::t('AdminModule.information', 'Current limit is: {currentLimit}', ['currentLimit' => Yii::$app->formatter->asShortSize($memoryLimit, 0)]);
if ($memoryLimit >= 64 * 1024 * 1024) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK',
'hint' => 'Current limit is: ' . Yii::$app->formatter->asShortSize($memoryLimit, 0)
'hint' => $currentLimitHint
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Increase memory limit in php.ini - Current limit is: ' . Yii::$app->formatter->asShortSize($memoryLimit, 0)
'hint' => Yii::t('AdminModule.information', 'Increase memory limit in {fileName}', ['fileName' => 'php.ini']) . ' - ' . $currentLimitHint
];
}
// Checks LDAP Extension
$title = 'PHP - LDAP Support';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Support', ['phpExtension' => 'LDAP']);
if (LdapHelper::isLdapAvailable()) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional - Install PHP LDAP Extension'
'hint' => Yii::t('AdminModule.information', 'Optional') . ' - '
. Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PHP LDAP'])
];
}
// Checks APC(u) Extension
$title = 'PHP - APC(u) Support';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Support', ['phpExtension' => 'APC(u)']);
if (function_exists('apc_add') || function_exists('apcu_add')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional - Install APCu Extension for APC Caching'
'hint' => Yii::t('AdminModule.information', 'Optional') . ' - '
. Yii::t('AdminModule.information', 'Install {phpExtension} Extension for APC Caching', ['phpExtension' => 'APCu'])
];
}
// Checks SQLite3 Extension
$title = 'PHP - SQLite3 Support';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Support', ['phpExtension' => 'SQLite3']);
if (class_exists('SQLite3')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Optional - Install SQLite3 Extension for DB Caching'
'hint' => Yii::t('AdminModule.information', 'Optional') . ' - '
. Yii::t('AdminModule.information', 'Install {phpExtension} Extension for DB Caching', ['phpExtension' => 'SQLite3'])
];
}
// Checks PDO MySQL Extension
$title = 'PHP - PDO MySQL Extension';
$title = 'PHP - ' . Yii::t('AdminModule.information', '{phpExtension} Extension', ['phpExtension' => 'PDO MySQL']);
if (extension_loaded('pdo_mysql')) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Install PDO MySQL Extension'
'hint' => Yii::t('AdminModule.information', 'Install {phpExtension} Extension', ['phpExtension' => 'PDO MySQL'])
];
}
@ -419,17 +414,17 @@ class SelfTest
$timeDiffMargin = 60;
$timeDiff = abs($dbConnectionTime->getTimestamp() - time());
$title = 'Settings - Time zone';
$title = Yii::t('AdminModule.information', 'Settings') . ' - ' . Yii::t('AdminModule.information', 'Time zone');
if ($timeDiff < $timeDiffMargin) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => Yii::t('base', 'Database connection time: {dbTime} - Configured time zone: {time}',
'hint' => Yii::t('AdminModule.information', 'Database connection time: {dbTime} - Configured time zone: {time}',
[
'dbTime' => Yii::$app->formatter->asTime($dbConnectionTime, 'short'),
'time' => Yii::$app->formatter->asTime(time(), 'short'),
@ -440,94 +435,88 @@ class SelfTest
}
// Check Runtime Directory
$title = 'Permissions - Runtime';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Runtime');
$path = Yii::getAlias('@runtime');
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
// Check Assets Directory
$title = 'Permissions - Assets';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Assets');
$path = Yii::getAlias('@webroot/assets');
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
// Check Uploads Directory
$title = 'Permissions - Uploads';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Uploads');
$path = Yii::getAlias('@webroot/uploads');
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
// Check Profile Image Directory
$title = 'Permissions - Profile Image';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Profile Image');
$path = Yii::getAlias('@webroot/uploads/profile_image');
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
// Check Custom Modules Directory
$title = 'Permissions - Module Directory';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Module Directory');
/** @var Module $marketplaceModule */
$marketplaceModule = Yii::$app->getModule('marketplace');
$path = Yii::getAlias($marketplaceModule->modulesPath);
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
// Check Custom Modules Directory
$title = 'Permissions - Dynamic Config';
$title = Yii::t('AdminModule.information', 'Permissions') . ' - ' . Yii::t('AdminModule.information', 'Dynamic Config');
$path = Yii::getAlias(Yii::$app->params['dynamicConfigFile']);
if (!is_file($path)) {
$path = dirname($path);
@ -535,14 +524,14 @@ class SelfTest
if (is_writeable($path)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'ERROR',
'hint' => 'Make ' . $path . " writable for the Webserver/PHP!"
'hint' => Yii::t('AdminModule.information', 'Make {filePath} writable for the Webserver/PHP!', ['filePath' => $path])
];
}
@ -572,11 +561,10 @@ class SelfTest
$recommendedEngine = 'InnoDB';
// Checks Database Driver
$title = 'Database driver';
$title = Yii::t('AdminModule.information', 'Database driver - {driver}', ['driver' => $driver['title']]);
if ($driver['isSupportedDriver']) {
$checks[] = [
'title' => Yii::t('base', $title) . ' - ' . $driver['title'],
'title' => $title,
'state' => 'OK'
];
} else {
@ -585,44 +573,44 @@ class SelfTest
$allowedDriverTitles[] = $allowedDriver['title'];
}
$checks[] = [
'title' => Yii::t('base', $title) . ' - ' . $driver['name'],
'title' => $title,
'state' => 'WARNING',
'hint' => 'Supported drivers: ' . implode(', ', $allowedDriverTitles),
'hint' => Yii::t('AdminModule.information', 'Supported drivers: {drivers}', ['drivers' => implode(', ', $allowedDriverTitles)]),
];
return $checks;
// Do NOT check below because the database driver is not supported.
}
// Checks Database Version
$title = $driver['title'] . ' - Version - ' . $driver['version'];
$title = $driver['title'] . ' - ' . Yii::t('AdminModule.information', 'Version') . ' - ' . $driver['version'];
if ($driver['isAllowedVersion']) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Minimum Version ' . $driver['minVersion'],
'hint' => Yii::t('AdminModule.information', 'Minimum Version {minVersion}', ['minVersion' => $driver['minVersion']])
];
}
// Checks Database Collation
$dbCharset = Yii::$app->getDb()->createCommand('SELECT @@collation_database')->queryScalar();
$title = $driver['title'] . ' - Database collation - ' . $dbCharset;
$title = $driver['title'] . ' - ' . Yii::t('AdminModule.information', 'Database collation') . ' - ' . $dbCharset;
if (stripos($dbCharset, $recommendedCollation) === 0) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Recommended collation is ' . $recommendedCollation,
'hint' => Yii::t('AdminModule.information', 'Recommended collation is {collation}', ['collation' => $recommendedCollation]),
];
}
@ -648,37 +636,43 @@ class SelfTest
}
// Checks Table Collations
$title = $driver['title'] . ' - Table collations - ' . implode(', ', $tableCollations);
$title = $driver['title'] . ' - ' . Yii::t('AdminModule.information', 'Table collations') . ' - ' . implode(', ', $tableCollations);
if (empty($tablesWithNotRecommendedCollations)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'WARNING',
'hint' => 'Recommended collation is ' . $recommendedCollation . ' for the tables: ' . implode(', ', $tablesWithNotRecommendedCollations),
'hint' => Yii::t('AdminModule.information', 'Recommended collation is {collation} for the tables: {tables}', [
'collation' => $recommendedCollation,
'tables' => implode(', ', $tablesWithNotRecommendedCollations),
])
];
}
// Checks Table Engines
$title = $driver['title'] . ' - Table engines - ' . implode(', ', $tableEngines);
$title = $driver['title'] . ' - ' . Yii::t('AdminModule.information', 'Table engines') . ' - ' . implode(', ', $tableEngines);
if (empty($tablesWithNotRecommendedEngines)) {
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => 'OK'
];
} else {
if (count($tableEngines) > 1) {
$title .= ' - Varying table engines are not supported.';
$title .= ' - ' . Yii::t('AdminModule.information', 'Varying table engines are not supported.');
}
$checks[] = [
'title' => Yii::t('base', $title),
'title' => $title,
'state' => count($tableEngines) > 1 ? 'ERROR' : 'WARNING',
'hint' => 'Recommended engine is ' . $recommendedEngine . ' for the tables: ' . implode(', ', $tablesWithNotRecommendedEngines),
'hint' => Yii::t('AdminModule.information', 'Recommended engine is {engine} for the tables: {tables}', [
'engine' => $recommendedEngine,
'tables' => implode(', ', $tablesWithNotRecommendedEngines),
])
];
}