aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-19 15:30:49 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-19 15:30:49 +0100
commit68003139e133835805b143b62c4407f19b495dab (patch)
tree9a71a15d021330fb6d55cc338f125161ddfc61dd /src/Wallabag/CoreBundle/Command/InstallCommand.php
parentbbd4ae7b56d9db744482a5630abad350f2d819af (diff)
parentcb1a6590c0e58c56d0612066501b3a586b103ed5 (diff)
downloadwallabag-68003139e133835805b143b62c4407f19b495dab.tar.gz
wallabag-68003139e133835805b143b62c4407f19b495dab.tar.zst
wallabag-68003139e133835805b143b62c4407f19b495dab.zip
Merge remote-tracking branch 'origin/master' into 2.2
# Conflicts: # .editorconfig # docs/de/index.rst # docs/de/user/import.rst # docs/en/index.rst # docs/en/user/configuration.rst # docs/en/user/import.rst # docs/fr/index.rst # docs/fr/user/import.rst # src/Wallabag/CoreBundle/Command/InstallCommand.php # src/Wallabag/CoreBundle/Resources/translations/messages.da.yml # src/Wallabag/CoreBundle/Resources/translations/messages.de.yml # src/Wallabag/CoreBundle/Resources/translations/messages.en.yml # src/Wallabag/CoreBundle/Resources/translations/messages.es.yml # src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml # src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml # src/Wallabag/CoreBundle/Resources/translations/messages.it.yml # src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml # src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml # src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml # src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml # src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml # src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig # web/bundles/wallabagcore/themes/baggy/css/style.min.css # web/bundles/wallabagcore/themes/baggy/js/baggy.min.js # web/bundles/wallabagcore/themes/material/css/style.min.css # web/bundles/wallabagcore/themes/material/js/material.min.js
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index c7e714af..e95c3a7b 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -72,6 +72,7 @@ class InstallCommand extends ContainerAwareCommand
72 protected function checkRequirements() 72 protected function checkRequirements()
73 { 73 {
74 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>'); 74 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>');
75 $doctrineManager = $this->getContainer()->get('doctrine')->getManager();
75 76
76 $rows = []; 77 $rows = [];
77 78
@@ -108,21 +109,39 @@ class InstallCommand extends ContainerAwareCommand
108 109
109 $rows[] = [$label, $status, $help]; 110 $rows[] = [$label, $status, $help];
110 111
112 // check MySQL & PostgreSQL version
113 $label = '<comment>Database version</comment>';
114 $status = '<info>OK!</info>';
115 $help = '';
116
111 // now check if MySQL isn't too old to handle utf8mb4 117 // now check if MySQL isn't too old to handle utf8mb4
112 if ($conn->isConnected() && $conn->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\MySqlPlatform) { 118 if ($conn->isConnected() && 'mysql' === $conn->getDatabasePlatform()->getName()) {
113 $version = $conn->query('select version()')->fetchColumn(); 119 $version = $conn->query('select version()')->fetchColumn();
114 $minimalVersion = '5.5.4'; 120 $minimalVersion = '5.5.4';
115 121
116 if (false === version_compare($version, $minimalVersion, '>')) { 122 if (false === version_compare($version, $minimalVersion, '>')) {
117 $fulfilled = false; 123 $fulfilled = false;
118 $rows[] = [ 124 $status = '<error>ERROR!</error>';
119 '<comment>Database version</comment>', 125 $help = 'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).';
120 '<error>ERROR!</error>',
121 'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).',
122 ];
123 } 126 }
124 } 127 }
125 128
129 // testing if PostgreSQL > 9.1
130 if ($conn->isConnected() && 'postgresql' === $conn->getDatabasePlatform()->getName()) {
131 // return version should be like "PostgreSQL 9.5.4 on x86_64-apple-darwin15.6.0, compiled by Apple LLVM version 8.0.0 (clang-800.0.38), 64-bit"
132 $version = $doctrineManager->getConnection()->query('SELECT version();')->fetchColumn();
133
134 preg_match('/PostgreSQL ([0-9\.]+)/i', $version, $matches);
135
136 if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) {
137 $fulfilled = false;
138 $status = '<error>ERROR!</error>';
139 $help = 'PostgreSQL should be greater than 9.1 (actual version: '.$matches[1].')';
140 }
141 }
142
143 $rows[] = [$label, $status, $help];
144
126 foreach ($this->functionExists as $functionRequired) { 145 foreach ($this->functionExists as $functionRequired) {
127 $label = '<comment>'.$functionRequired.'</comment>'; 146 $label = '<comment>'.$functionRequired.'</comment>';
128 $status = '<info>OK!</info>'; 147 $status = '<info>OK!</info>';