diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Command/InstallCommand.php | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php index 3c76545c..3aa332f1 100644 --- a/src/Wallabag/CoreBundle/Command/InstallCommand.php +++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php | |||
@@ -2,7 +2,6 @@ | |||
2 | 2 | ||
3 | namespace Wallabag\CoreBundle\Command; | 3 | namespace Wallabag\CoreBundle\Command; |
4 | 4 | ||
5 | use Craue\ConfigBundle\Entity\Setting; | ||
6 | use FOS\UserBundle\Event\UserEvent; | 5 | use FOS\UserBundle\Event\UserEvent; |
7 | use FOS\UserBundle\FOSUserEvents; | 6 | use FOS\UserBundle\FOSUserEvents; |
8 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; | 7 | use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; |
@@ -13,6 +12,7 @@ use Symfony\Component\Console\Output\BufferedOutput; | |||
13 | use Symfony\Component\Console\Output\OutputInterface; | 12 | use Symfony\Component\Console\Output\OutputInterface; |
14 | use Symfony\Component\Console\Question\Question; | 13 | use Symfony\Component\Console\Question\Question; |
15 | use Symfony\Component\Console\Style\SymfonyStyle; | 14 | use Symfony\Component\Console\Style\SymfonyStyle; |
15 | use Wallabag\CoreBundle\Entity\InternalSetting; | ||
16 | 16 | ||
17 | class InstallCommand extends ContainerAwareCommand | 17 | class InstallCommand extends ContainerAwareCommand |
18 | { | 18 | { |
@@ -54,7 +54,7 @@ class InstallCommand extends ContainerAwareCommand | |||
54 | 54 | ||
55 | $this->io = new SymfonyStyle($input, $output); | 55 | $this->io = new SymfonyStyle($input, $output); |
56 | 56 | ||
57 | $this->io->title('Wallabag installer'); | 57 | $this->io->title('wallabag installer'); |
58 | 58 | ||
59 | $this | 59 | $this |
60 | ->checkRequirements() | 60 | ->checkRequirements() |
@@ -63,7 +63,7 @@ class InstallCommand extends ContainerAwareCommand | |||
63 | ->setupConfig() | 63 | ->setupConfig() |
64 | ; | 64 | ; |
65 | 65 | ||
66 | $this->io->success('Wallabag has been successfully installed.'); | 66 | $this->io->success('wallabag has been successfully installed.'); |
67 | $this->io->success('You can now configure your web server, see https://doc.wallabag.org'); | 67 | $this->io->success('You can now configure your web server, see https://doc.wallabag.org'); |
68 | } | 68 | } |
69 | 69 | ||
@@ -94,8 +94,9 @@ class InstallCommand extends ContainerAwareCommand | |||
94 | $status = '<info>OK!</info>'; | 94 | $status = '<info>OK!</info>'; |
95 | $help = ''; | 95 | $help = ''; |
96 | 96 | ||
97 | $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection(); | ||
98 | |||
97 | try { | 99 | try { |
98 | $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection(); | ||
99 | $conn->connect(); | 100 | $conn->connect(); |
100 | } catch (\Exception $e) { | 101 | } catch (\Exception $e) { |
101 | if (false === strpos($e->getMessage(), 'Unknown database') | 102 | if (false === strpos($e->getMessage(), 'Unknown database') |
@@ -253,7 +254,7 @@ class InstallCommand extends ContainerAwareCommand | |||
253 | $question->setHidden(true); | 254 | $question->setHidden(true); |
254 | $user->setPlainPassword($this->io->askQuestion($question)); | 255 | $user->setPlainPassword($this->io->askQuestion($question)); |
255 | 256 | ||
256 | $user->setEmail($this->io->ask('Email', '')); | 257 | $user->setEmail($this->io->ask('Email', 'wallabag@wallabag.io')); |
257 | 258 | ||
258 | $user->setEnabled(true); | 259 | $user->setEnabled(true); |
259 | $user->addRole('ROLE_SUPER_ADMIN'); | 260 | $user->addRole('ROLE_SUPER_ADMIN'); |
@@ -275,10 +276,10 @@ class InstallCommand extends ContainerAwareCommand | |||
275 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); | 276 | $em = $this->getContainer()->get('doctrine.orm.entity_manager'); |
276 | 277 | ||
277 | // cleanup before insert new stuff | 278 | // cleanup before insert new stuff |
278 | $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); | 279 | $em->createQuery('DELETE FROM WallabagCoreBundle:InternalSetting')->execute(); |
279 | 280 | ||
280 | foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) { | 281 | foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) { |
281 | $newSetting = new Setting(); | 282 | $newSetting = new InternalSetting(); |
282 | $newSetting->setName($setting['name']); | 283 | $newSetting->setName($setting['name']); |
283 | $newSetting->setValue($setting['value']); | 284 | $newSetting->setValue($setting['value']); |
284 | $newSetting->setSection($setting['section']); | 285 | $newSetting->setSection($setting['section']); |
@@ -325,9 +326,7 @@ class InstallCommand extends ContainerAwareCommand | |||
325 | if (0 !== $exitCode) { | 326 | if (0 !== $exitCode) { |
326 | $this->getApplication()->setAutoExit(true); | 327 | $this->getApplication()->setAutoExit(true); |
327 | 328 | ||
328 | throw new \RuntimeException( | 329 | throw new \RuntimeException('The command "' . $command . "\" generates some errors: \n\n" . $output->fetch()); |
329 | 'The command "' . $command . "\" generates some errors: \n\n" | ||
330 | . $output->fetch()); | ||
331 | } | 330 | } |
332 | 331 | ||
333 | return $this; | 332 | return $this; |