aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index c9dad0df..6665f4b5 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -73,36 +73,36 @@ class InstallCommand extends ContainerAwareCommand
73 73
74 $fulfilled = true; 74 $fulfilled = true;
75 75
76 $label = '<comment>PDO Drivers</comment>'; 76 $label = '<comment>PDO Driver</comment>';
77 if (extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql')) { 77 $status = '<info>OK!</info>';
78 $status = '<info>OK!</info>'; 78 $help = '';
79 $help = ''; 79
80 } else { 80 if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) {
81 $fulfilled = false; 81 $fulfilled = false;
82 $status = '<error>ERROR!</error>'; 82 $status = '<error>ERROR!</error>';
83 $help = 'Needs one of sqlite, mysql or pgsql PDO drivers'; 83 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
84 } 84 }
85 85
86 $rows[] = array($label, $status, $help); 86 $rows = [];
87 $rows[] = [$label, $status, $help];
87 88
88 foreach ($this->functionExists as $functionRequired) { 89 foreach ($this->functionExists as $functionRequired) {
89 $label = '<comment>'.$functionRequired.'</comment>'; 90 $label = '<comment>'.$functionRequired.'</comment>';
91 $status = '<info>OK!</info>';
92 $help = '';
90 93
91 if (function_exists($functionRequired)) { 94 if (!function_exists($functionRequired)) {
92 $status = '<info>OK!</info>';
93 $help = '';
94 } else {
95 $fulfilled = false; 95 $fulfilled = false;
96 $status = '<error>ERROR!</error>'; 96 $status = '<error>ERROR!</error>';
97 $help = 'You need the '.$functionRequired.' function activated'; 97 $help = 'You need the '.$functionRequired.' function activated';
98 } 98 }
99 99
100 $rows[] = array($label, $status, $help); 100 $rows[] = [$label, $status, $help];
101 } 101 }
102 102
103 $table = new Table($this->defaultOutput); 103 $table = new Table($this->defaultOutput);
104 $table 104 $table
105 ->setHeaders(array('Checked', 'Status', 'Recommendation')) 105 ->setHeaders(['Checked', 'Status', 'Recommendation'])
106 ->setRows($rows) 106 ->setRows($rows)
107 ->render(); 107 ->render();
108 108
@@ -126,7 +126,7 @@ class InstallCommand extends ContainerAwareCommand
126 $this->defaultOutput->writeln('Droping database, creating database and schema, clearing the cache'); 126 $this->defaultOutput->writeln('Droping database, creating database and schema, clearing the cache');
127 127
128 $this 128 $this
129 ->runCommand('doctrine:database:drop', array('--force' => true)) 129 ->runCommand('doctrine:database:drop', ['--force' => true])
130 ->runCommand('doctrine:database:create') 130 ->runCommand('doctrine:database:create')
131 ->runCommand('doctrine:schema:create') 131 ->runCommand('doctrine:schema:create')
132 ->runCommand('cache:clear') 132 ->runCommand('cache:clear')
@@ -158,7 +158,7 @@ class InstallCommand extends ContainerAwareCommand
158 $this->defaultOutput->writeln('Droping database, creating database and schema'); 158 $this->defaultOutput->writeln('Droping database, creating database and schema');
159 159
160 $this 160 $this
161 ->runCommand('doctrine:database:drop', array('--force' => true)) 161 ->runCommand('doctrine:database:drop', ['--force' => true])
162 ->runCommand('doctrine:database:create') 162 ->runCommand('doctrine:database:create')
163 ->runCommand('doctrine:schema:create') 163 ->runCommand('doctrine:schema:create')
164 ; 164 ;
@@ -168,7 +168,7 @@ class InstallCommand extends ContainerAwareCommand
168 $this->defaultOutput->writeln('Droping schema and creating schema'); 168 $this->defaultOutput->writeln('Droping schema and creating schema');
169 169
170 $this 170 $this
171 ->runCommand('doctrine:schema:drop', array('--force' => true)) 171 ->runCommand('doctrine:schema:drop', ['--force' => true])
172 ->runCommand('doctrine:schema:create') 172 ->runCommand('doctrine:schema:create')
173 ; 173 ;
174 } 174 }
@@ -388,19 +388,19 @@ class InstallCommand extends ContainerAwareCommand
388 * @param string $command 388 * @param string $command
389 * @param array $parameters Parameters to this command (usually 'force' => true) 389 * @param array $parameters Parameters to this command (usually 'force' => true)
390 */ 390 */
391 protected function runCommand($command, $parameters = array()) 391 protected function runCommand($command, $parameters = [])
392 { 392 {
393 $parameters = array_merge( 393 $parameters = array_merge(
394 array('command' => $command), 394 ['command' => $command],
395 $parameters, 395 $parameters,
396 array( 396 [
397 '--no-debug' => true, 397 '--no-debug' => true,
398 '--env' => $this->defaultInput->getOption('env') ?: 'dev', 398 '--env' => $this->defaultInput->getOption('env') ?: 'dev',
399 ) 399 ]
400 ); 400 );
401 401
402 if ($this->defaultInput->getOption('no-interaction')) { 402 if ($this->defaultInput->getOption('no-interaction')) {
403 $parameters = array_merge($parameters, array('--no-interaction' => true)); 403 $parameters = array_merge($parameters, ['--no-interaction' => true]);
404 } 404 }
405 405
406 $this->getApplication()->setAutoExit(false); 406 $this->getApplication()->setAutoExit(false);