aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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 813ac720..035eb865 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -72,8 +72,10 @@ class InstallCommand extends ContainerAwareCommand
72 { 72 {
73 $this->defaultOutput->writeln('<info><comment>Step 1 of 5.</comment> Checking system requirements.</info>'); 73 $this->defaultOutput->writeln('<info><comment>Step 1 of 5.</comment> Checking system requirements.</info>');
74 74
75 $fulfilled = true; 75 $rows = [];
76 76
77 // testing if database driver exists
78 $fulfilled = true;
77 $label = '<comment>PDO Driver</comment>'; 79 $label = '<comment>PDO Driver</comment>';
78 $status = '<info>OK!</info>'; 80 $status = '<info>OK!</info>';
79 $help = ''; 81 $help = '';
@@ -84,7 +86,23 @@ class InstallCommand extends ContainerAwareCommand
84 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; 86 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
85 } 87 }
86 88
87 $rows = []; 89 $rows[] = [$label, $status, $help];
90
91 // testing if connection to the database can be etablished
92 $label = '<comment>Database connection</comment>';
93 $status = '<info>OK!</info>';
94 $help = '';
95
96 try {
97 $this->getContainer()->get('doctrine')->getManager()->getConnection()->connect();
98 } catch (\Exception $e) {
99 if (false === strpos($e->getMessage(), 'Unknown database')) {
100 $fulfilled = false;
101 $status = '<error>ERROR!</error>';
102 $help = 'Can\'t connect to the database: '.$e->getMessage();
103 }
104 }
105
88 $rows[] = [$label, $status, $help]; 106 $rows[] = [$label, $status, $help];
89 107
90 foreach ($this->functionExists as $functionRequired) { 108 foreach ($this->functionExists as $functionRequired) {
@@ -456,7 +474,7 @@ class InstallCommand extends ContainerAwareCommand
456 } 474 }
457 475
458 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite 476 // custom verification for sqlite, since `getListDatabasesSQL` doesn't work for sqlite
459 if ('sqlite' == $schemaManager->getDatabasePlatform()->getName()) { 477 if ('sqlite' === $schemaManager->getDatabasePlatform()->getName()) {
460 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams(); 478 $params = $this->getContainer()->get('doctrine.dbal.default_connection')->getParams();
461 479
462 if (isset($params['path']) && file_exists($params['path'])) { 480 if (isset($params['path']) && file_exists($params['path'])) {