+ $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.';
+ }
+
+ $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help];
+
+ // testing if connection to the database can be etablished
+ $label = '<comment>Database connection</comment>';
+ $status = '<info>OK!</info>';
+ $help = '';
+
+ try {
+ $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
+ $conn->connect();
+ } catch (\Exception $e) {
+ if (false === strpos($e->getMessage(), 'Unknown database')
+ && false === strpos($e->getMessage(), 'database "' . $this->getContainer()->getParameter('database_name') . '" does not exist')) {
+ $fulfilled = false;
+ $status = '<error>ERROR!</error>';
+ $help = 'Can\'t connect to the database: ' . $e->getMessage();
+ }
+ }
+
+ $rows[] = [$label, $status, $help];
+
+ // check MySQL & PostgreSQL version
+ $label = '<comment>Database version</comment>';
+ $status = '<info>OK!</info>';
+ $help = '';
+
+ // now check if MySQL isn't too old to handle utf8mb4
+ if ($conn->isConnected() && 'mysql' === $conn->getDatabasePlatform()->getName()) {
+ $version = $conn->query('select version()')->fetchColumn();
+ $minimalVersion = '5.5.4';
+
+ if (false === version_compare($version, $minimalVersion, '>')) {
+ $fulfilled = false;
+ $status = '<error>ERROR!</error>';
+ $help = 'Your MySQL version (' . $version . ') is too old, consider upgrading (' . $minimalVersion . '+).';
+ }