diff --git a/app/Config/database.default.php b/app/Config/database.default.php index e65cc6deb..615abe872 100644 --- a/app/Config/database.default.php +++ b/app/Config/database.default.php @@ -70,6 +70,6 @@ class DATABASE_CONFIG { 'password' => 'db password', 'database' => 'misp', 'prefix' => '', - //'encoding' => 'utf8', + 'encoding' => 'utf8', ); } diff --git a/app/Controller/ServersController.php b/app/Controller/ServersController.php index 0b324d09f..d5472e269 100644 --- a/app/Controller/ServersController.php +++ b/app/Controller/ServersController.php @@ -720,7 +720,7 @@ class ServersController extends AppController { // if Proxy is set up in the settings, try to connect to a test URL $proxyStatus = $this->Server->proxyDiagnostics($diagnostic_errors); - + $moduleTypes = array('Enrichment', 'Import', 'Export'); foreach ($moduleTypes as $type) { $moduleStatus[$type] = $this->Server->moduleDiagnostics($diagnostic_errors, $type); @@ -738,9 +738,12 @@ class ServersController extends AppController { $writeableFiles = $this->Server->writeableFilesDiagnostics($diagnostic_errors); $readableFiles = $this->Server->readableFilesDiagnostics($diagnostic_errors); $extensions = $this->Server->extensionDiagnostics(); + + // check if the encoding is not set to utf8 + $dbEncodingStatus = $this->Server->databaseEncodingDiagnostics($diagnostic_errors); $viewVars = array( - 'diagnostic_errors', 'tabs', 'tab', 'issues', 'finalSettings', 'writeableErrors', 'readableErrors', 'writeableDirs', 'writeableFiles', 'readableFiles', 'extensions' + 'diagnostic_errors', 'tabs', 'tab', 'issues', 'finalSettings', 'writeableErrors', 'readableErrors', 'writeableDirs', 'writeableFiles', 'readableFiles', 'extensions', 'dbEncodingStatus' ); $viewVars = array_merge($viewVars, $additionalViewVars); foreach ($viewVars as $viewVar) $this->set($viewVar, ${$viewVar}); diff --git a/app/Model/Server.php b/app/Model/Server.php index a2123263d..c871630c6 100644 --- a/app/Model/Server.php +++ b/app/Model/Server.php @@ -3293,4 +3293,12 @@ class Server extends AppModel { } return $results; } + + public function databaseEncodingDiagnostics(&$diagnostic_errors) { + if (!isset($this->getDataSource()->config['encoding']) || strtolower($this->getDataSource()->config['encoding']) != 'utf8') { + $diagnostic_errors++; + return false; + } + return true; + } } diff --git a/app/View/Elements/healthElements/diagnostics.ctp b/app/View/Elements/healthElements/diagnostics.ctp index 19fd76e01..59dc7b39a 100644 --- a/app/View/Elements/healthElements/diagnostics.ctp +++ b/app/View/Elements/healthElements/diagnostics.ctp @@ -1,4 +1,11 @@
+ +
Incorrect database encoding setting: Your database connection is currently NOT set to UTF-8. Please make sure to uncomment the 'encoding' => 'utf8' line in Config/database.php
+

MISP version

Since version 2.3.14, every version of MISP includes a json file with the current version. This is checked against the latest tag on github, if there is a version mismatch the tool will warn you about it. Make sure that you update MISP regularly.