]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Command/InstallCommand.php
Update deps
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Command / InstallCommand.php
index dec2bf9c15c7e6477a65b088a20fb3c6b3212c05..3aa332f131597a292ab830f80932afb24cc4ceab 100644 (file)
@@ -2,7 +2,6 @@
 
 namespace Wallabag\CoreBundle\Command;
 
-use Craue\ConfigBundle\Entity\Setting;
 use FOS\UserBundle\Event\UserEvent;
 use FOS\UserBundle\FOSUserEvents;
 use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
@@ -13,6 +12,7 @@ use Symfony\Component\Console\Output\BufferedOutput;
 use Symfony\Component\Console\Output\OutputInterface;
 use Symfony\Component\Console\Question\Question;
 use Symfony\Component\Console\Style\SymfonyStyle;
+use Wallabag\CoreBundle\Entity\InternalSetting;
 
 class InstallCommand extends ContainerAwareCommand
 {
@@ -54,7 +54,7 @@ class InstallCommand extends ContainerAwareCommand
 
         $this->io = new SymfonyStyle($input, $output);
 
-        $this->io->title('Wallabag installer');
+        $this->io->title('wallabag installer');
 
         $this
             ->checkRequirements()
@@ -63,8 +63,8 @@ class InstallCommand extends ContainerAwareCommand
             ->setupConfig()
         ;
 
-        $this->io->success('Wallabag has been successfully installed.');
-        $this->io->note('Just execute `php bin/console server:run --env=prod` for using wallabag: http://localhost:8000');
+        $this->io->success('wallabag has been successfully installed.');
+        $this->io->success('You can now configure your web server, see https://doc.wallabag.org');
     }
 
     protected function checkRequirements()
@@ -81,7 +81,7 @@ class InstallCommand extends ContainerAwareCommand
         $status = '<info>OK!</info>';
         $help = '';
 
-        if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) {
+        if (!\extension_loaded($this->getContainer()->getParameter('database_driver'))) {
             $fulfilled = false;
             $status = '<error>ERROR!</error>';
             $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.';
@@ -94,8 +94,9 @@ class InstallCommand extends ContainerAwareCommand
         $status = '<info>OK!</info>';
         $help = '';
 
+        $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
+
         try {
-            $conn = $this->getContainer()->get('doctrine')->getManager()->getConnection();
             $conn->connect();
         } catch (\Exception $e) {
             if (false === strpos($e->getMessage(), 'Unknown database')
@@ -146,7 +147,7 @@ class InstallCommand extends ContainerAwareCommand
             $status = '<info>OK!</info>';
             $help = '';
 
-            if (!function_exists($functionRequired)) {
+            if (!\function_exists($functionRequired)) {
                 $fulfilled = false;
                 $status = '<error>ERROR!</error>';
                 $help = 'You need the ' . $functionRequired . ' function activated';
@@ -253,7 +254,7 @@ class InstallCommand extends ContainerAwareCommand
         $question->setHidden(true);
         $user->setPlainPassword($this->io->askQuestion($question));
 
-        $user->setEmail($this->io->ask('Email', ''));
+        $user->setEmail($this->io->ask('Email', 'wallabag@wallabag.io'));
 
         $user->setEnabled(true);
         $user->addRole('ROLE_SUPER_ADMIN');
@@ -275,10 +276,10 @@ class InstallCommand extends ContainerAwareCommand
         $em = $this->getContainer()->get('doctrine.orm.entity_manager');
 
         // cleanup before insert new stuff
-        $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
+        $em->createQuery('DELETE FROM WallabagCoreBundle:InternalSetting')->execute();
 
         foreach ($this->getContainer()->getParameter('wallabag_core.default_internal_settings') as $setting) {
-            $newSetting = new Setting();
+            $newSetting = new InternalSetting();
             $newSetting->setName($setting['name']);
             $newSetting->setValue($setting['value']);
             $newSetting->setSection($setting['section']);
@@ -325,9 +326,7 @@ class InstallCommand extends ContainerAwareCommand
         if (0 !== $exitCode) {
             $this->getApplication()->setAutoExit(true);
 
-            throw new \RuntimeException(
-                'The command "' . $command . "\" generates some errors: \n\n"
-                . $output->fetch());
+            throw new \RuntimeException('The command "' . $command . "\" generates some errors: \n\n" . $output->fetch());
         }
 
         return $this;
@@ -371,7 +370,7 @@ class InstallCommand extends ContainerAwareCommand
         }
 
         try {
-            return in_array($databaseName, $schemaManager->listDatabases(), true);
+            return \in_array($databaseName, $schemaManager->listDatabases(), true);
         } catch (\Doctrine\DBAL\Exception\DriverException $e) {
             // it means we weren't able to get database list, assume the database doesn't exist
 
@@ -389,6 +388,6 @@ class InstallCommand extends ContainerAwareCommand
     {
         $schemaManager = $this->getContainer()->get('doctrine')->getManager()->getConnection()->getSchemaManager();
 
-        return count($schemaManager->listTableNames()) > 0 ? true : false;
+        return \count($schemaManager->listTableNames()) > 0 ? true : false;
     }
 }