aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Command')
-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'])) {