aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-09-19 11:23:07 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-09-19 11:23:07 +0200
commitd7b4b2c72cd1c9ad967ecfec668d5b0b9e794149 (patch)
treed20f88d9e9157bf9721c77913096dcd6875231b5 /src/Wallabag/CoreBundle/Command/InstallCommand.php
parentda18a4682f124b02278860d23ac1d59dee995277 (diff)
parentf9feca5c64309a2a202258bb92ae24b7a1dbe31c (diff)
downloadwallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.tar.gz
wallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.tar.zst
wallabag-d7b4b2c72cd1c9ad967ecfec668d5b0b9e794149.zip
Merge remote-tracking branch 'origin/master' into 2.1
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index bd7b55f9..3873d2d3 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -71,8 +71,10 @@ class InstallCommand extends ContainerAwareCommand
71 { 71 {
72 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>'); 72 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>');
73 73
74 $fulfilled = true; 74 $rows = [];
75 75
76 // testing if database driver exists
77 $fulfilled = true;
76 $label = '<comment>PDO Driver</comment>'; 78 $label = '<comment>PDO Driver</comment>';
77 $status = '<info>OK!</info>'; 79 $status = '<info>OK!</info>';
78 $help = ''; 80 $help = '';
@@ -83,7 +85,23 @@ class InstallCommand extends ContainerAwareCommand
83 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; 85 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
84 } 86 }
85 87
86 $rows = []; 88 $rows[] = [$label, $status, $help];
89
90 // testing if connection to the database can be etablished
91 $label = '<comment>Database connection</comment>';
92 $status = '<info>OK!</info>';
93 $help = '';
94
95 try {
96 $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
97 } catch (\Exception $e) {
98 if (false === strpos($e->getMessage(), 'Unknown database')) {
99 $fulfilled = false;
100 $status = '<error>ERROR!</error>';
101 $help = 'Can\'t connect to the database: '.$e->getMessage();
102 }
103 }
104
87 $rows[] = [$label, $status, $help]; 105 $rows[] = [$label, $status, $help];
88 106
89 foreach ($this->functionExists as $functionRequired) { 107 foreach ($this->functionExists as $functionRequired) {
@@ -451,7 +469,7 @@ class InstallCommand extends ContainerAwareCommand
451 } 469 }
452 470
453 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite 471 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
454 if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { 472 if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
455 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); 473 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams();
456 474
457 if (isset($params['path']) && file_exists($params['path'])) { 475 if (isset($params['path']) && file_exists($params['path'])) {