mirror of
https://github.com/wallabag/wallabag.git
synced 2024-11-26 11:01:04 +00:00
Add verification check for MySQL version
Must now be >= 5.5.4
This commit is contained in:
parent
b0de88f75d
commit
fc79f1ffa8
3 changed files with 20 additions and 4 deletions
|
@ -19,8 +19,8 @@ parameters:
|
|||
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
|
||||
database_table_prefix: wallabag_
|
||||
database_socket: null
|
||||
# with MySQL, use "utf8mb4" if got problem with content with emojis
|
||||
database_charset: utf8mb4
|
||||
# with MySQL, use "utf8mb4" if you got problem with content with emojis
|
||||
database_charset: utf8
|
||||
|
||||
mailer_transport: smtp
|
||||
mailer_host: 127.0.0.1
|
||||
|
|
|
@ -6,4 +6,4 @@ parameters:
|
|||
test_database_user: ~
|
||||
test_database_password: ~
|
||||
test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite"
|
||||
test_database_charset: utf8mb4
|
||||
test_database_charset: utf8
|
||||
|
|
|
@ -95,7 +95,8 @@ class InstallCommand extends ContainerAwareCommand
|
|||
$help = '';
|
||||
|
||||
try {
|
||||
$this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
|
||||
$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')) {
|
||||
|
@ -107,6 +108,21 @@ class InstallCommand extends ContainerAwareCommand
|
|||
|
||||
$rows[] = [$label, $status, $help];
|
||||
|
||||
// now check if MySQL isn't too old to handle utf8mb4
|
||||
if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) {
|
||||
$version = $conn->query('select version()')->fetchColumn();
|
||||
$minimalVersion = '5.5.4';
|
||||
|
||||
if (false === version_compare($version, $minimalVersion, '>')) {
|
||||
$fulfilled = false;
|
||||
$rows[] = [
|
||||
'<comment>Database version</comment>',
|
||||
'<error>ERROR!</error>',
|
||||
'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($this->functionExists as $functionRequired) {
|
||||
$label = '<comment>'.$functionRequired.'</comment>';
|
||||
$status = '<info>OK!</info>';
|
||||
|
|
Loading…
Reference in a new issue