aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command/InstallCommand.php
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-04-11 19:37:29 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-04-11 19:37:29 +0200
commit637dc4bb21edf8f3b0b0926aa50fa5ffdf362db8 (patch)
treedf86ecf2e2faf6340094ce23945d72813469f55c /src/Wallabag/CoreBundle/Command/InstallCommand.php
parenta83fbf4504f08612020792bd454bf1c881fb3c14 (diff)
downloadwallabag-637dc4bb21edf8f3b0b0926aa50fa5ffdf362db8.tar.gz
wallabag-637dc4bb21edf8f3b0b0926aa50fa5ffdf362db8.tar.zst
wallabag-637dc4bb21edf8f3b0b0926aa50fa5ffdf362db8.zip
Move setup config outside setupAdmin
If user doesn't want to create a new admin (even if it's recommended) the internal config weren't created resulting in error when using the interface.
Diffstat (limited to 'src/Wallabag/CoreBundle/Command/InstallCommand.php')
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 2e4a59df..e56ee4af 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -60,6 +60,7 @@ class InstallCommand extends ContainerAwareCommand
60 ->checkRequirements() 60 ->checkRequirements()
61 ->setupDatabase() 61 ->setupDatabase()
62 ->setupAdmin() 62 ->setupAdmin()
63 ->setupConfig()
63 ->setupAsset() 64 ->setupAsset()
64 ; 65 ;
65 66
@@ -69,7 +70,7 @@ class InstallCommand extends ContainerAwareCommand
69 70
70 protected function checkRequirements() 71 protected function checkRequirements()
71 { 72 {
72 $this->defaultOutput->writeln('<info><comment>Step 1 of 4.</comment> Checking system requirements.</info>'); 73 $this->defaultOutput->writeln('<info><comment>Step 1 of 5.</comment> Checking system requirements.</info>');
73 74
74 $fulfilled = true; 75 $fulfilled = true;
75 76
@@ -119,7 +120,7 @@ class InstallCommand extends ContainerAwareCommand
119 120
120 protected function setupDatabase() 121 protected function setupDatabase()
121 { 122 {
122 $this->defaultOutput->writeln('<info><comment>Step 2 of 4.</comment> Setting up database.</info>'); 123 $this->defaultOutput->writeln('<info><comment>Step 2 of 5.</comment> Setting up database.</info>');
123 124
124 // user want to reset everything? Don't care about what is already here 125 // user want to reset everything? Don't care about what is already here
125 if (true === $this->defaultInput->getOption('reset')) { 126 if (true === $this->defaultInput->getOption('reset')) {
@@ -190,7 +191,7 @@ class InstallCommand extends ContainerAwareCommand
190 191
191 protected function setupAdmin() 192 protected function setupAdmin()
192 { 193 {
193 $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>'); 194 $this->defaultOutput->writeln('<info><comment>Step 3 of 5.</comment> Administration setup.</info>');
194 195
195 $questionHelper = $this->getHelperSet()->get('question'); 196 $questionHelper = $this->getHelperSet()->get('question');
196 $question = new ConfirmationQuestion('Would you like to create a new admin user (recommended) ? (Y/n)', true); 197 $question = new ConfirmationQuestion('Would you like to create a new admin user (recommended) ? (Y/n)', true);
@@ -227,6 +228,16 @@ class InstallCommand extends ContainerAwareCommand
227 228
228 $em->persist($config); 229 $em->persist($config);
229 230
231 $this->defaultOutput->writeln('');
232
233 return $this;
234 }
235
236 protected function setupConfig()
237 {
238 $this->defaultOutput->writeln('<info><comment>Step 4 of 5.</comment> Config setup.</info>');
239 $em = $this->getContainer()->get('doctrine.orm.entity_manager');
240
230 // cleanup before insert new stuff 241 // cleanup before insert new stuff
231 $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute(); 242 $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
232 243
@@ -365,7 +376,7 @@ class InstallCommand extends ContainerAwareCommand
365 376
366 protected function setupAsset() 377 protected function setupAsset()
367 { 378 {
368 $this->defaultOutput->writeln('<info><comment>Step 4 of 4.</comment> Installing assets.</info>'); 379 $this->defaultOutput->writeln('<info><comment>Step 5 of 5.</comment> Installing assets.</info>');
369 380
370 $this 381 $this
371 ->runCommand('assets:install') 382 ->runCommand('assets:install')