aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Command
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Command')
-rw-r--r--src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php4
-rw-r--r--src/Wallabag/CoreBundle/Command/ExportCommand.php2
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php22
3 files changed, 14 insertions, 14 deletions
diff --git a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
index 74da1e5f..d964439d 100644
--- a/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
+++ b/src/Wallabag/CoreBundle/Command/CleanDuplicatesCommand.php
@@ -76,7 +76,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
76 $url = $this->similarUrl($entry['url']); 76 $url = $this->similarUrl($entry['url']);
77 77
78 /* @var $entry Entry */ 78 /* @var $entry Entry */
79 if (in_array($url, $urls)) { 79 if (in_array($url, $urls, true)) {
80 ++$duplicatesCount; 80 ++$duplicatesCount;
81 81
82 $em->remove($repo->find($entry['id'])); 82 $em->remove($repo->find($entry['id']));
@@ -93,7 +93,7 @@ class CleanDuplicatesCommand extends ContainerAwareCommand
93 93
94 private function similarUrl($url) 94 private function similarUrl($url)
95 { 95 {
96 if (in_array(substr($url, -1), ['/', '#'])) { // get rid of "/" and "#" and the end of urls 96 if (in_array(substr($url, -1), ['/', '#'], true)) { // get rid of "/" and "#" and the end of urls
97 return substr($url, 0, strlen($url)); 97 return substr($url, 0, strlen($url));
98 } 98 }
99 99
diff --git a/src/Wallabag/CoreBundle/Command/ExportCommand.php b/src/Wallabag/CoreBundle/Command/ExportCommand.php
index ebb2b4cf..0dacb734 100644
--- a/src/Wallabag/CoreBundle/Command/ExportCommand.php
+++ b/src/Wallabag/CoreBundle/Command/ExportCommand.php
@@ -49,7 +49,7 @@ class ExportCommand extends ContainerAwareCommand
49 $filePath = $input->getArgument('filepath'); 49 $filePath = $input->getArgument('filepath');
50 50
51 if (!$filePath) { 51 if (!$filePath) {
52 $filePath = $this->getContainer()->getParameter('kernel.root_dir').'/../'.sprintf('%s-export.json', $user->getUsername()); 52 $filePath = $this->getContainer()->getParameter('kernel.root_dir') . '/../' . sprintf('%s-export.json', $user->getUsername());
53 } 53 }
54 54
55 try { 55 try {
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index eb725a59..50551480 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -2,6 +2,7 @@
2 2
3namespace Wallabag\CoreBundle\Command; 3namespace Wallabag\CoreBundle\Command;
4 4
5use Craue\ConfigBundle\Entity\Setting;
5use FOS\UserBundle\Event\UserEvent; 6use FOS\UserBundle\Event\UserEvent;
6use FOS\UserBundle\FOSUserEvents; 7use FOS\UserBundle\FOSUserEvents;
7use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand; 8use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
@@ -14,7 +15,6 @@ use Symfony\Component\Console\Output\OutputInterface;
14use Symfony\Component\Console\Question\ConfirmationQuestion; 15use Symfony\Component\Console\Question\ConfirmationQuestion;
15use Symfony\Component\Console\Question\Question; 16use Symfony\Component\Console\Question\Question;
16use Wallabag\CoreBundle\Entity\Config; 17use Wallabag\CoreBundle\Entity\Config;
17use Craue\ConfigBundle\Entity\Setting;
18 18
19class InstallCommand extends ContainerAwareCommand 19class InstallCommand extends ContainerAwareCommand
20{ 20{
@@ -86,7 +86,7 @@ class InstallCommand extends ContainerAwareCommand
86 if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) { 86 if (!extension_loaded($this->getContainer()->getParameter('database_driver'))) {
87 $fulfilled = false; 87 $fulfilled = false;
88 $status = '<error>ERROR!</error>'; 88 $status = '<error>ERROR!</error>';
89 $help = 'Database driver "'.$this->getContainer()->getParameter('database_driver').'" is not installed.'; 89 $help = 'Database driver "' . $this->getContainer()->getParameter('database_driver') . '" is not installed.';
90 } 90 }
91 91
92 $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help]; 92 $rows[] = [sprintf($label, $this->getContainer()->getParameter('database_driver')), $status, $help];
@@ -101,10 +101,10 @@ class InstallCommand extends ContainerAwareCommand
101 $conn->connect(); 101 $conn->connect();
102 } catch (\Exception $e) { 102 } catch (\Exception $e) {
103 if (false === strpos($e->getMessage(), 'Unknown database') 103 if (false === strpos($e->getMessage(), 'Unknown database')
104 && false === strpos($e->getMessage(), 'database "'.$this->getContainer()->getParameter('database_name').'" does not exist')) { 104 && false === strpos($e->getMessage(), 'database "' . $this->getContainer()->getParameter('database_name') . '" does not exist')) {
105 $fulfilled = false; 105 $fulfilled = false;
106 $status = '<error>ERROR!</error>'; 106 $status = '<error>ERROR!</error>';
107 $help = 'Can\'t connect to the database: '.$e->getMessage(); 107 $help = 'Can\'t connect to the database: ' . $e->getMessage();
108 } 108 }
109 } 109 }
110 110
@@ -123,7 +123,7 @@ class InstallCommand extends ContainerAwareCommand
123 if (false === version_compare($version, $minimalVersion, '>')) { 123 if (false === version_compare($version, $minimalVersion, '>')) {
124 $fulfilled = false; 124 $fulfilled = false;
125 $status = '<error>ERROR!</error>'; 125 $status = '<error>ERROR!</error>';
126 $help = 'Your MySQL version ('.$version.') is too old, consider upgrading ('.$minimalVersion.'+).'; 126 $help = 'Your MySQL version (' . $version . ') is too old, consider upgrading (' . $minimalVersion . '+).';
127 } 127 }
128 } 128 }
129 129
@@ -137,21 +137,21 @@ class InstallCommand extends ContainerAwareCommand
137 if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) { 137 if (isset($matches[1]) & version_compare($matches[1], '9.2.0', '<')) {
138 $fulfilled = false; 138 $fulfilled = false;
139 $status = '<error>ERROR!</error>'; 139 $status = '<error>ERROR!</error>';
140 $help = 'PostgreSQL should be greater than 9.1 (actual version: '.$matches[1].')'; 140 $help = 'PostgreSQL should be greater than 9.1 (actual version: ' . $matches[1] . ')';
141 } 141 }
142 } 142 }
143 143
144 $rows[] = [$label, $status, $help]; 144 $rows[] = [$label, $status, $help];
145 145
146 foreach ($this->functionExists as $functionRequired) { 146 foreach ($this->functionExists as $functionRequired) {
147 $label = '<comment>'.$functionRequired.'</comment>'; 147 $label = '<comment>' . $functionRequired . '</comment>';
148 $status = '<info>OK!</info>'; 148 $status = '<info>OK!</info>';
149 $help = ''; 149 $help = '';
150 150
151 if (!function_exists($functionRequired)) { 151 if (!function_exists($functionRequired)) {
152 $fulfilled = false; 152 $fulfilled = false;
153 $status = '<error>ERROR!</error>'; 153 $status = '<error>ERROR!</error>';
154 $help = 'You need the '.$functionRequired.' function activated'; 154 $help = 'You need the ' . $functionRequired . ' function activated';
155 } 155 }
156 156
157 $rows[] = [$label, $status, $help]; 157 $rows[] = [$label, $status, $help];
@@ -351,8 +351,8 @@ class InstallCommand extends ContainerAwareCommand
351 $this->getApplication()->setAutoExit(true); 351 $this->getApplication()->setAutoExit(true);
352 352
353 throw new \RuntimeException( 353 throw new \RuntimeException(
354 'The command "'.$command."\" generates some errors: \n\n" 354 'The command "' . $command . "\" generates some errors: \n\n"
355 .$output->fetch()); 355 . $output->fetch());
356 } 356 }
357 357
358 return $this; 358 return $this;
@@ -396,7 +396,7 @@ class InstallCommand extends ContainerAwareCommand
396 } 396 }
397 397
398 try { 398 try {
399 return in_array($databaseName, $schemaManager->listDatabases()); 399 return in_array($databaseName, $schemaManager->listDatabases(), true);
400 } catch (\Doctrine\DBAL\Exception\DriverException $e) { 400 } catch (\Doctrine\DBAL\Exception\DriverException $e) {
401 // it means we weren't able to get database list, assume the database doesn't exist 401 // it means we weren't able to get database list, assume the database doesn't exist
402 402