Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php')
-rw-r--r--plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php b/plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php
index f867bcce67..563c904bcc 100644
--- a/plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php
+++ b/plugins/Diagnostics/Diagnostic/DatabaseAbilitiesCheck.php
@@ -10,6 +10,7 @@ namespace Piwik\Plugins\Diagnostics\Diagnostic;
use Piwik\Common;
use Piwik\Config;
use Piwik\Db;
+use Piwik\DbHelper;
use Piwik\Translation\Translator;
/**
@@ -37,6 +38,8 @@ class DatabaseAbilitiesCheck implements Diagnostic
$result = new DiagnosticResult($this->translator->translate('Installation_DatabaseAbilities'));
+ $result->addItem($this->checkUtf8mb4Charset());
+
if (Config::getInstance()->General['enable_load_data_infile']) {
$result->addItem($this->checkLoadDataInfile());
}
@@ -47,6 +50,34 @@ class DatabaseAbilitiesCheck implements Diagnostic
return [$result];
}
+ protected function checkUtf8mb4Charset()
+ {
+ $dbSettings = new Db\Settings();
+ $charset = $dbSettings->getUsedCharset();
+
+ if (DbHelper::getDefaultCharset() === 'utf8mb4' && $charset === 'utf8mb4') {
+ return new DiagnosticResultItem(DiagnosticResult::STATUS_OK, 'UTF8mb4 charset');
+ }
+
+ if (DbHelper::getDefaultCharset() === 'utf8mb4') {
+ return new DiagnosticResultItem(
+ DiagnosticResult::STATUS_WARNING, 'UTF8mb4 charset<br/><br/>' .
+ $this->translator->translate('Diagnostics_DatabaseUtf8mb4CharsetAvailableButNotUsed', '<code>' . PIWIK_INCLUDE_PATH . '/console core:convert-to-utf8mb4</code>') .
+ '<br/><br/>' .
+ $this->translator->translate('Diagnostics_DatabaseUtf8Requirement', ['�', '<a href="https://matomo.org/faq/how-to-update/how-to-convert-the-database-to-utf8mb4-charset/" rel="noreferrer noopener" target="_blank">', '</a>']) .
+ '<br/>'
+ );
+ }
+
+ return new DiagnosticResultItem(
+ DiagnosticResult::STATUS_WARNING, 'UTF8mb4 charset<br/><br/>' .
+ $this->translator->translate('Diagnostics_DatabaseUtf8mb4CharsetRecommended') .
+ '<br/><br/>' .
+ $this->translator->translate('Diagnostics_DatabaseUtf8Requirement', ['�', '<a href="https://matomo.org/faq/how-to-update/how-to-convert-the-database-to-utf8mb4-charset/" rel="noreferrer noopener" target="_blank">', '</a>']) .
+ '<br/>'
+ );
+ }
+
protected function checkLoadDataInfile()
{
$optionTable = Common::prefixTable('option');