]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Command/InstallCommand.php
Fix internal settings
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Command / InstallCommand.php
index c9dad0df71eff039030eb6aea08ac663ec1325f6..c5a5a519ceb3dd5f0df69d1a98eaeacad6a20778 100644 (file)
@@ -73,36 +73,36 @@ class InstallCommand extends ContainerAwareCommand
 
         $fulfilled = true;
 
-        $label = '<comment>PDO Drivers</comment>';
-        if (extension_loaded('pdo_sqlite') || extension_loaded('pdo_mysql') || extension_loaded('pdo_pgsql')) {
-            $status = '<info>OK!</info>';
-            $help = '';
-        } else {
+        $label = '<comment>PDO Driver</comment>';
+        $status = '<info>OK!</info>';
+        $help = '';
+
+        if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) {
             $fulfilled = false;
             $status = '<error>ERROR!</error>';
-            $help = 'Needs one of sqlite, mysql or pgsql PDO drivers';
+            $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.';
         }
 
-        $rows[] = array($label, $status, $help);
+        $rows = [];
+        $rows[] = [$label, $status, $help];
 
         foreach ($this->functionExists as $functionRequired) {
             $label = '<comment>'.$functionRequired.'</comment>';
+            $status = '<info>OK!</info>';
+            $help = '';
 
-            if (function_exists($functionRequired)) {
-                $status = '<info>OK!</info>';
-                $help = '';
-            } else {
+            if (!function_exists($functionRequired)) {
                 $fulfilled = false;
                 $status = '<error>ERROR!</error>';
                 $help = 'You need the '.$functionRequired.' function activated';
             }
 
-            $rows[] = array($label, $status, $help);
+            $rows[] = [$label, $status, $help];
         }
 
         $table = new Table($this->defaultOutput);
         $table
-            ->setHeaders(array('Checked', 'Status', 'Recommendation'))
+            ->setHeaders(['Checked', 'Status', 'Recommendation'])
             ->setRows($rows)
             ->render();
 
@@ -126,7 +126,7 @@ class InstallCommand extends ContainerAwareCommand
             $this->defaultOutput->writeln('Droping database, creating database and schema, clearing the cache');
 
             $this
-                ->runCommand('doctrine:database:drop', array('--force' => true))
+                ->runCommand('doctrine:database:drop', ['--force' => true])
                 ->runCommand('doctrine:database:create')
                 ->runCommand('doctrine:schema:create')
                 ->runCommand('cache:clear')
@@ -158,7 +158,7 @@ class InstallCommand extends ContainerAwareCommand
             $this->defaultOutput->writeln('Droping database, creating database and schema');
 
             $this
-                ->runCommand('doctrine:database:drop', array('--force' => true))
+                ->runCommand('doctrine:database:drop', ['--force' => true])
                 ->runCommand('doctrine:database:create')
                 ->runCommand('doctrine:schema:create')
             ;
@@ -168,7 +168,7 @@ class InstallCommand extends ContainerAwareCommand
                 $this->defaultOutput->writeln('Droping schema and creating schema');
 
                 $this
-                    ->runCommand('doctrine:schema:drop', array('--force' => true))
+                    ->runCommand('doctrine:schema:drop', ['--force' => true])
                     ->runCommand('doctrine:schema:create')
                 ;
             }
@@ -231,11 +231,6 @@ class InstallCommand extends ContainerAwareCommand
         $em->createQuery('DELETE FROM CraueConfigBundle:Setting')->execute();
 
         $settings = [
-            [
-                'name' => 'download_pictures',
-                'value' => '1',
-                'section' => 'entry',
-            ],
             [
                 'name' => 'carrot',
                 'value' => '1',
@@ -388,19 +383,19 @@ class InstallCommand extends ContainerAwareCommand
      * @param string $command
      * @param array  $parameters Parameters to this command (usually 'force' => true)
      */
-    protected function runCommand($command, $parameters = array())
+    protected function runCommand($command, $parameters = [])
     {
         $parameters = array_merge(
-            array('command' => $command),
+            ['command' => $command],
             $parameters,
-            array(
+            [
                 '--no-debug' => true,
                 '--env' => $this->defaultInput->getOption('env') ?: 'dev',
-            )
+            ]
         );
 
         if ($this->defaultInput->getOption('no-interaction')) {
-            $parameters = array_merge($parameters, array('--no-interaction' => true));
+            $parameters = array_merge($parameters, ['--no-interaction' => true]);
         }
 
         $this->getApplication()->setAutoExit(false);