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.php50
1 files changed, 21 insertions, 29 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 035eb865..cc7c2c94 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -2,6 +2,8 @@
2 2
3namespace Wallabag\CoreBundle\Command; 3namespace Wallabag\CoreBundle\Command;
4 4
5use FOS\UserBundle\Event\UserEvent;
6use FOS\UserBundle\FOSUserEvents;
5use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 7use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
6use Symfony\Component\Console\Helper\Table; 8use Symfony\Component\Console\Helper\Table;
7use Symfony\Component\Console\Input\ArrayInput; 9use Symfony\Component\Console\Input\ArrayInput;
@@ -61,7 +63,6 @@ class InstallCommand extends ContainerAwareCommand
61 ->setupDatabase() 63 ->setupDatabase()
62 ->setupAdmin() 64 ->setupAdmin()
63 ->setupConfig() 65 ->setupConfig()
64 ->setupAsset()
65 ; 66 ;
66 67
67 $output->writeln('<info>Wallabag has been successfully installed.</info>'); 68 $output->writeln('<info>Wallabag has been successfully installed.</info>');
@@ -70,7 +71,7 @@ class InstallCommand extends ContainerAwareCommand
70 71
71 protected function checkRequirements() 72 protected function checkRequirements()
72 { 73 {
73 $this->defaultOutput->writeln('<info><comment>Step 1 of 5.</comment> Checking system requirements.</info>'); 74 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>');
74 75
75 $rows = []; 76 $rows = [];
76 77
@@ -138,7 +139,7 @@ class InstallCommand extends ContainerAwareCommand
138 139
139 protected function setupDatabase() 140 protected function setupDatabase()
140 { 141 {
141 $this->defaultOutput->writeln('<info><comment>Step 2 of 5.</comment> Setting up database.</info>'); 142 $this->defaultOutput->writeln('<info><comment>Step 2 of 4.</comment> Setting up database.</info>');
142 143
143 // user want to reset everything? Don't care about what is already here 144 // user want to reset everything? Don't care about what is already here
144 if (true === $this->defaultInput->getOption('reset')) { 145 if (true === $this->defaultInput->getOption('reset')) {
@@ -209,7 +210,7 @@ class InstallCommand extends ContainerAwareCommand
209 210
210 protected function setupAdmin() 211 protected function setupAdmin()
211 { 212 {
212 $this->defaultOutput->writeln('<info><comment>Step 3 of 5.</comment> Administration setup.</info>'); 213 $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>');
213 214
214 $questionHelper = $this->getHelperSet()->get('question'); 215 $questionHelper = $this->getHelperSet()->get('question');
215 $question = new ConfirmationQuestion('Would you like to create a new admin user (recommended) ? (Y/n)', true); 216 $question = new ConfirmationQuestion('Would you like to create a new admin user (recommended) ? (Y/n)', true);
@@ -237,14 +238,9 @@ class InstallCommand extends ContainerAwareCommand
237 238
238 $em->persist($user); 239 $em->persist($user);
239 240
240 $config = new Config($user); 241 // dispatch a created event so the associated config will be created
241 $config->setTheme($this->getContainer()->getParameter('wallabag_core.theme')); 242 $event = new UserEvent($user);
242 $config->setItemsPerPage($this->getContainer()->getParameter('wallabag_core.items_on_page')); 243 $this->getContainer()->get('event_dispatcher')->dispatch(FOSUserEvents::USER_CREATED, $event);
243 $config->setRssLimit($this->getContainer()->getParameter('wallabag_core.rss_limit'));
244 $config->setReadingSpeed($this->getContainer()->getParameter('wallabag_core.reading_speed'));
245 $config->setLanguage($this->getContainer()->getParameter('wallabag_core.language'));
246
247 $em->persist($config);
248 244
249 $this->defaultOutput->writeln(''); 245 $this->defaultOutput->writeln('');
250 246
@@ -253,7 +249,7 @@ class InstallCommand extends ContainerAwareCommand
253 249
254 protected function setupConfig() 250 protected function setupConfig()
255 { 251 {
256 $this->defaultOutput->writeln('<info><comment>Step 4 of 5.</comment> Config setup.</info>'); 252 $this->defaultOutput->writeln('<info><comment>Step 4 of 4.</comment> Config setup.</info>');
257 $em = $this->getContainer()->get('doctrine.orm.entity_manager'); 253 $em = $this->getContainer()->get('doctrine.orm.entity_manager');
258 254
259 // cleanup before insert new stuff 255 // cleanup before insert new stuff
@@ -261,6 +257,11 @@ class InstallCommand extends ContainerAwareCommand
261 257
262 $settings = [ 258 $settings = [
263 [ 259 [
260 'name' => 'share_public',
261 'value' => '1',
262 'section' => 'entry',
263 ],
264 [
264 'name' => 'carrot', 265 'name' => 'carrot',
265 'value' => '1', 266 'value' => '1',
266 'section' => 'entry', 267 'section' => 'entry',
@@ -331,8 +332,13 @@ class InstallCommand extends ContainerAwareCommand
331 'section' => 'export', 332 'section' => 'export',
332 ], 333 ],
333 [ 334 [
334 'name' => 'pocket_consumer_key', 335 'name' => 'import_with_redis',
335 'value' => null, 336 'value' => '0',
337 'section' => 'import',
338 ],
339 [
340 'name' => 'import_with_rabbitmq',
341 'value' => '0',
336 'section' => 'import', 342 'section' => 'import',
337 ], 343 ],
338 [ 344 [
@@ -392,20 +398,6 @@ class InstallCommand extends ContainerAwareCommand
392 return $this; 398 return $this;
393 } 399 }
394 400
395 protected function setupAsset()
396 {
397 $this->defaultOutput->writeln('<info><comment>Step 5 of 5.</comment> Installing assets.</info>');
398
399 $this
400 ->runCommand('assets:install')
401 ->runCommand('assetic:dump')
402 ;
403
404 $this->defaultOutput->writeln('');
405
406 return $this;
407 }
408
409 /** 401 /**
410 * Run a command. 402 * Run a command.
411 * 403 *