diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index eb725a59..50551480 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Command; | 3 | namespace Wallabag\CoreBundle\Command; |
4 | 4 | ||
5 | use Craue\ConfigBundle\Entity\Setting; | ||
5 | use FOS\UserBundle\Event\UserEvent; | 6 | use FOS\UserBundle\Event\UserEvent; |
6 | use FOS\UserBundle\FOSUserEvents; | 7 | use FOS\UserBundle\FOSUserEvents; |
7 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | 8 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
@@ -14,7 +15,6 @@ use Symfony\Component\Console\Output\OutputInterface; | |||
14 | use Symfony\Component\Console\Question\ConfirmationQuestion; | 15 | use Symfony\Component\Console\Question\ConfirmationQuestion; |
15 | use Symfony\Component\Console\Question\Question; | 16 | use Symfony\Component\Console\Question\Question; |
16 | use Wallabag\CoreBundle\Entity\Config; | 17 | use Wallabag\CoreBundle\Entity\Config; |
17 | use Craue\ConfigBundle\Entity\Setting; | ||
18 | 18 | ||
19 | class InstallCommand extends ContainerAwareCommand | 19 | class InstallCommand extends ContainerAwareCommand |
20 | { | 20 | { |
@@ -86,7 +86,7 @@ class InstallCommand extends ContainerAwareCommand | |||
86 | if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) { | 86 | if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) { |
87 | $fulfilled = false; | 87 | $fulfilled = false; |
88 | $status = '<error>ERROR!</error>'; | 88 | $status = '<error>ERROR!</error>'; |
89 | $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; | 89 | $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.'; |
90 | } | 90 | } |
91 | 91 | ||
92 | $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help]; | 92 | $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help]; |
@@ -101,10 +101,10 @@ class InstallCommand extends ContainerAwareCommand | |||
101 | $conn->connect(); | 101 | $conn->connect(); |
102 | } catch (\Exception $e) { | 102 | } catch (\Exception $e) { |
103 | if (false === strpos($e->getMessage(), 'Unknown database') | 103 | if (false === strpos($e->getMessage(), 'Unknown database') |
104 | && false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) { | 104 | && false === strpos($e->getMessage(), 'database "' . $this->getContainer()->getParameter('database_name') . '" does not exist')) { |
105 | $fulfilled = false; | 105 | $fulfilled = false; |
106 | $status = '<error>ERROR!</error>'; | 106 | $status = '<error>ERROR!</error>'; |
107 | $help = 'Can\'t connect to the database: '.$e->getMessage(); | 107 | $help = 'Can\'t connect to the database: ' . $e->getMessage(); |
108 | } | 108 | } |
109 | } | 109 | } |
110 | 110 | ||
@@ -123,7 +123,7 @@ class InstallCommand extends ContainerAwareCommand | |||
123 | if (false === version_compare($version, $minimalVersion, '>')) { | 123 | if (false === version_compare($version, $minimalVersion, '>')) { |
124 | $fulfilled = false; | 124 | $fulfilled = false; |
125 | $status = '<error>ERROR!</error>'; | 125 | $status = '<error>ERROR!</error>'; |
126 | $help = 'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).'; | 126 | $help = 'Your MySQL version (' . $version . ') is too old, consider upgrading (' . $minimalVersion . '+).'; |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
@@ -137,21 +137,21 @@ class InstallCommand extends ContainerAwareCommand | |||
137 | if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) { | 137 | if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) { |
138 | $fulfilled = false; | 138 | $fulfilled = false; |
139 | $status = '<error>ERROR!</error>'; | 139 | $status = '<error>ERROR!</error>'; |
140 | $help = 'PostgreSQL should be greater than 9.1 (actual version: '.$matches[1].')'; | 140 | $help = 'PostgreSQL should be greater than 9.1 (actual version: ' . $matches[1] . ')'; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | 143 | ||
144 | $rows[] = [$label, $status, $help]; | 144 | $rows[] = [$label, $status, $help]; |
145 | 145 | ||
146 | foreach ($this->functionExists as $functionRequired) { | 146 | foreach ($this->functionExists as $functionRequired) { |
147 | $label = '<comment>'.$functionRequired.'</comment>'; | 147 | $label = '<comment>' . $functionRequired . '</comment>'; |
148 | $status = '<info>OK!</info>'; | 148 | $status = '<info>OK!</info>'; |
149 | $help = ''; | 149 | $help = ''; |
150 | 150 | ||
151 | if (!function_exists($functionRequired)) { | 151 | if (!function_exists($functionRequired)) { |
152 | $fulfilled = false; | 152 | $fulfilled = false; |
153 | $status = '<error>ERROR!</error>'; | 153 | $status = '<error>ERROR!</error>'; |
154 | $help = 'You need the '.$functionRequired.' function activated'; | 154 | $help = 'You need the ' . $functionRequired . ' function activated'; |
155 | } | 155 | } |
156 | 156 | ||
157 | $rows[] = [$label, $status, $help]; | 157 | $rows[] = [$label, $status, $help]; |
@@ -351,8 +351,8 @@ class InstallCommand extends ContainerAwareCommand | |||
351 | $this->getApplication()->setAutoExit(true); | 351 | $this->getApplication()->setAutoExit(true); |
352 | 352 | ||
353 | throw new \RuntimeException( | 353 | throw new \RuntimeException( |
354 | 'The command "'.$command."\" generates some errors: \n\n" | 354 | 'The command "' . $command . "\" generates some errors: \n\n" |
355 | .$output->fetch()); | 355 | . $output->fetch()); |
356 | } | 356 | } |
357 | 357 | ||
358 | return $this; | 358 | return $this; |
@@ -396,7 +396,7 @@ class InstallCommand extends ContainerAwareCommand | |||
396 | } | 396 | } |
397 | 397 | ||
398 | try { | 398 | try { |
399 | return in_array($databaseName, $schemaManager->listDatabases()); | 399 | return in_array($databaseName, $schemaManager->listDatabases(), true); |
400 | } catch (\Doctrine\DBAL\Exception\DriverException $e) { | 400 | } catch (\Doctrine\DBAL\Exception\DriverException $e) { |
401 | // it means we weren't able to get database list, assume the database doesn't exist | 401 | // it means we weren't able to get database list, assume the database doesn't exist |
402 | 402 | ||