aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-19 11:30:55 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-19 11:32:56 +0100
commitcffcce0c921ca9360daa96e90bbf3e34642b262e (patch)
tree63b4ac9956d7f8855bd26300825a1d3fe3de02d4 /src
parent8853914ba4fdc42d9676598e3db79a4d07e3b697 (diff)
downloadwallabag-cffcce0c921ca9360daa96e90bbf3e34642b262e.tar.gz
wallabag-cffcce0c921ca9360daa96e90bbf3e34642b262e.tar.zst
wallabag-cffcce0c921ca9360daa96e90bbf3e34642b262e.zip
Wallabag can’t work on PostgreSQL <= 9.1
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php23
1 files changed, 22 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 857a8b4c..2daf2dd8 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
@@ -95,7 +96,7 @@ class InstallCommand extends ContainerAwareCommand
95 $help = ''; 96 $help = '';
96 97
97 try { 98 try {
98 $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); 99 $doctrineManager->getConnection()->connect();
99 } catch (\Exception $e) { 100 } catch (\Exception $e) {
100 if (false === strpos($e->getMessage(), 'Unknown database') 101 if (false === strpos($e->getMessage(), 'Unknown database')
101 && false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) { 102 && false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) {
@@ -107,6 +108,26 @@ class InstallCommand extends ContainerAwareCommand
107 108
108 $rows[] = [$label, $status, $help]; 109 $rows[] = [$label, $status, $help];
109 110
111 // testing if PostgreSQL > 9.1
112 $label = '<comment>SGBD version</comment>';
113 $status = '<info>OK!</info>';
114 $help = '';
115
116 if ('postgresql' === $doctrineManager->getConnection()->getSchemaManager()->getDatabasePlatform()->getName()) {
117 // 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"
118 $version = $doctrineManager->getConnection()->query('SELECT version();')->fetchColumn();
119
120 preg_match('/PostgreSQL ([0-9\.]+)/i', $version, $matches);
121
122 if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) {
123 $fulfilled = false;
124 $status = '<error>ERROR!</error>';
125 $help = 'PostgreSQL should be greater than 9.1 (actual version: '.$matches[1].')';
126 }
127 }
128
129 $rows[] = [$label, $status, $help];
130
110 foreach ($this->functionExists as $functionRequired) { 131 foreach ($this->functionExists as $functionRequired) {
111 $label = '<comment>'.$functionRequired.'</comment>'; 132 $label = '<comment>'.$functionRequired.'</comment>';
112 $status = '<info>OK!</info>'; 133 $status = '<info>OK!</info>';