X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FCommand%2FInstallCommand.php;h=2daf2dd85ae3cd372c0c130fdd3700a04aaa776e;hb=cffcce0c921ca9360daa96e90bbf3e34642b262e;hp=8e438229f9584d788b299ce51d634939e791eac2;hpb=8eeefc658c500c0839512ac2e259e194ab943d2c;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 8e438229..2daf2dd8 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php @@ -72,6 +72,7 @@ class InstallCommand extends ContainerAwareCommand protected function checkRequirements() { $this->defaultOutput->writeln('Step 1 of 4. Checking system requirements.'); + $doctrineManager = $this->getContainer()->get('doctrine')->getManager(); $rows = []; @@ -95,7 +96,7 @@ class InstallCommand extends ContainerAwareCommand $help = ''; try { - $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect(); + $doctrineManager->getConnection()->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,26 @@ class InstallCommand extends ContainerAwareCommand $rows[] = [$label, $status, $help]; + // testing if PostgreSQL > 9.1 + $label = 'SGBD version'; + $status = 'OK!'; + $help = ''; + + if ('postgresql' === $doctrineManager->getConnection()->getSchemaManager()->getDatabasePlatform()->getName()) { + // 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" + $version = $doctrineManager->getConnection()->query('SELECT version();')->fetchColumn(); + + preg_match('/PostgreSQL ([0-9\.]+)/i', $version, $matches); + + if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) { + $fulfilled = false; + $status = 'ERROR!'; + $help = 'PostgreSQL should be greater than 9.1 (actual version: '.$matches[1].')'; + } + } + + $rows[] = [$label, $status, $help]; + foreach ($this->functionExists as $functionRequired) { $label = ''.$functionRequired.''; $status = 'OK!'; @@ -364,7 +385,7 @@ class InstallCommand extends ContainerAwareCommand ], [ 'name' => 'piwik_host', - 'value' => 'http://v2.wallabag.org', + 'value' => 'v2.wallabag.org', 'section' => 'analytics', ], [