aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/ImportBundle
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-10-11 09:55:03 +0200
committerGitHub <noreply@github.com>2017-10-11 09:55:03 +0200
commitd8dc7372ab3d8ac4c5d5546e5c5e00bf4bf2d862 (patch)
tree3f7ea5ce149b98d01a32f45c2d5be43fbf8ea21c /src/Wallabag/ImportBundle
parent21bdbb2d5e8ef1a93a51bc6d55e041f95820b4ba (diff)
parentf645d371ce55e9c2a45712df34244318742b0d74 (diff)
downloadwallabag-d8dc7372ab3d8ac4c5d5546e5c5e00bf4bf2d862.tar.gz
wallabag-d8dc7372ab3d8ac4c5d5546e5c5e00bf4bf2d862.tar.zst
wallabag-d8dc7372ab3d8ac4c5d5546e5c5e00bf4bf2d862.zip
Merge pull request #3376 from wallabag/symfony-3.3
Symfony 3.3
Diffstat (limited to 'src/Wallabag/ImportBundle')
-rw-r--r--src/Wallabag/ImportBundle/Import/AbstractImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/BrowserImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/ChromeImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/FirefoxImport.php2
-rw-r--r--src/Wallabag/ImportBundle/Import/InstapaperImport.php6
-rw-r--r--src/Wallabag/ImportBundle/Import/PocketImport.php12
-rw-r--r--src/Wallabag/ImportBundle/Import/WallabagV1Import.php2
7 files changed, 14 insertions, 14 deletions
diff --git a/src/Wallabag/ImportBundle/Import/AbstractImport.php b/src/Wallabag/ImportBundle/Import/AbstractImport.php
index cb46db09..58a234f4 100644
--- a/src/Wallabag/ImportBundle/Import/AbstractImport.php
+++ b/src/Wallabag/ImportBundle/Import/AbstractImport.php
@@ -165,7 +165,7 @@ abstract class AbstractImport implements ImportInterface
165 $entryToBeFlushed[] = $entry; 165 $entryToBeFlushed[] = $entry;
166 166
167 // flush every 20 entries 167 // flush every 20 entries
168 if (($i % 20) === 0) { 168 if (0 === ($i % 20)) {
169 $this->em->flush(); 169 $this->em->flush();
170 170
171 foreach ($entryToBeFlushed as $entry) { 171 foreach ($entryToBeFlushed as $entry) {
diff --git a/src/Wallabag/ImportBundle/Import/BrowserImport.php b/src/Wallabag/ImportBundle/Import/BrowserImport.php
index 78077324..b5593180 100644
--- a/src/Wallabag/ImportBundle/Import/BrowserImport.php
+++ b/src/Wallabag/ImportBundle/Import/BrowserImport.php
@@ -171,7 +171,7 @@ abstract class BrowserImport extends AbstractImport
171 $entryToBeFlushed[] = $entry; 171 $entryToBeFlushed[] = $entry;
172 172
173 // flush every 20 entries 173 // flush every 20 entries
174 if (($i % 20) === 0) { 174 if (0 === ($i % 20)) {
175 $this->em->flush(); 175 $this->em->flush();
176 176
177 foreach ($entryToBeFlushed as $entry) { 177 foreach ($entryToBeFlushed as $entry) {
diff --git a/src/Wallabag/ImportBundle/Import/ChromeImport.php b/src/Wallabag/ImportBundle/Import/ChromeImport.php
index e3ba636a..09183abe 100644
--- a/src/Wallabag/ImportBundle/Import/ChromeImport.php
+++ b/src/Wallabag/ImportBundle/Import/ChromeImport.php
@@ -45,7 +45,7 @@ class ChromeImport extends BrowserImport
45 'created_at' => substr($entry['date_added'], 0, 10), 45 'created_at' => substr($entry['date_added'], 0, 10),
46 ]; 46 ];
47 47
48 if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { 48 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) {
49 $data['tags'] = $entry['tags']; 49 $data['tags'] = $entry['tags'];
50 } 50 }
51 51
diff --git a/src/Wallabag/ImportBundle/Import/FirefoxImport.php b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
index c18e7e93..73269fe1 100644
--- a/src/Wallabag/ImportBundle/Import/FirefoxImport.php
+++ b/src/Wallabag/ImportBundle/Import/FirefoxImport.php
@@ -45,7 +45,7 @@ class FirefoxImport extends BrowserImport
45 'created_at' => substr($entry['dateAdded'], 0, 10), 45 'created_at' => substr($entry['dateAdded'], 0, 10),
46 ]; 46 ];
47 47
48 if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { 48 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) {
49 $data['tags'] = $entry['tags']; 49 $data['tags'] = $entry['tags'];
50 } 50 }
51 51
diff --git a/src/Wallabag/ImportBundle/Import/InstapaperImport.php b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
index 7d70154a..7ab69e7a 100644
--- a/src/Wallabag/ImportBundle/Import/InstapaperImport.php
+++ b/src/Wallabag/ImportBundle/Import/InstapaperImport.php
@@ -63,7 +63,7 @@ class InstapaperImport extends AbstractImport
63 63
64 $entries = []; 64 $entries = [];
65 $handle = fopen($this->filepath, 'r'); 65 $handle = fopen($this->filepath, 'r');
66 while (($data = fgetcsv($handle, 10240)) !== false) { 66 while (false !== ($data = fgetcsv($handle, 10240))) {
67 if ('URL' === $data[0]) { 67 if ('URL' === $data[0]) {
68 continue; 68 continue;
69 } 69 }
@@ -80,8 +80,8 @@ class InstapaperImport extends AbstractImport
80 'url' => $data[0], 80 'url' => $data[0],
81 'title' => $data[1], 81 'title' => $data[1],
82 'status' => $data[3], 82 'status' => $data[3],
83 'is_archived' => $data[3] === 'Archive' || $data[3] === 'Starred', 83 'is_archived' => 'Archive' === $data[3] || 'Starred' === $data[3],
84 'is_starred' => $data[3] === 'Starred', 84 'is_starred' => 'Starred' === $data[3],
85 'html' => false, 85 'html' => false,
86 'tags' => $tags, 86 'tags' => $tags,
87 ]; 87 ];
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php
index 7d38826b..dddb87f4 100644
--- a/src/Wallabag/ImportBundle/Import/PocketImport.php
+++ b/src/Wallabag/ImportBundle/Import/PocketImport.php
@@ -149,7 +149,7 @@ class PocketImport extends AbstractImport
149 // - first call get 5k offset 0 149 // - first call get 5k offset 0
150 // - second call get 5k offset 5k 150 // - second call get 5k offset 5k
151 // - and so on 151 // - and so on
152 if (count($entries['list']) === self::NB_ELEMENTS) { 152 if (self::NB_ELEMENTS === count($entries['list'])) {
153 ++$run; 153 ++$run;
154 154
155 return $this->import(self::NB_ELEMENTS * $run); 155 return $this->import(self::NB_ELEMENTS * $run);
@@ -175,7 +175,7 @@ class PocketImport extends AbstractImport
175 */ 175 */
176 public function parseEntry(array $importedEntry) 176 public function parseEntry(array $importedEntry)
177 { 177 {
178 $url = isset($importedEntry['resolved_url']) && $importedEntry['resolved_url'] !== '' ? $importedEntry['resolved_url'] : $importedEntry['given_url']; 178 $url = isset($importedEntry['resolved_url']) && '' !== $importedEntry['resolved_url'] ? $importedEntry['resolved_url'] : $importedEntry['given_url'];
179 179
180 $existingEntry = $this->em 180 $existingEntry = $this->em
181 ->getRepository('WallabagCoreBundle:Entry') 181 ->getRepository('WallabagCoreBundle:Entry')
@@ -194,15 +194,15 @@ class PocketImport extends AbstractImport
194 $this->fetchContent($entry, $url); 194 $this->fetchContent($entry, $url);
195 195
196 // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted 196 // 0, 1, 2 - 1 if the item is archived - 2 if the item should be deleted
197 $entry->setArchived($importedEntry['status'] === 1 || $this->markAsRead); 197 $entry->setArchived(1 === $importedEntry['status'] || $this->markAsRead);
198 198
199 // 0 or 1 - 1 If the item is starred 199 // 0 or 1 - 1 If the item is starred
200 $entry->setStarred($importedEntry['favorite'] === 1); 200 $entry->setStarred(1 === $importedEntry['favorite']);
201 201
202 $title = 'Untitled'; 202 $title = 'Untitled';
203 if (isset($importedEntry['resolved_title']) && $importedEntry['resolved_title'] !== '') { 203 if (isset($importedEntry['resolved_title']) && '' !== $importedEntry['resolved_title']) {
204 $title = $importedEntry['resolved_title']; 204 $title = $importedEntry['resolved_title'];
205 } elseif (isset($importedEntry['given_title']) && $importedEntry['given_title'] !== '') { 205 } elseif (isset($importedEntry['given_title']) && '' !== $importedEntry['given_title']) {
206 $title = $importedEntry['given_title']; 206 $title = $importedEntry['given_title'];
207 } 207 }
208 208
diff --git a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
index d585d44d..a35c411e 100644
--- a/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
+++ b/src/Wallabag/ImportBundle/Import/WallabagV1Import.php
@@ -61,7 +61,7 @@ class WallabagV1Import extends WallabagImport
61 $data['html'] = $this->fetchingErrorMessage; 61 $data['html'] = $this->fetchingErrorMessage;
62 } 62 }
63 63
64 if (array_key_exists('tags', $entry) && $entry['tags'] !== '') { 64 if (array_key_exists('tags', $entry) && '' !== $entry['tags']) {
65 $data['tags'] = $entry['tags']; 65 $data['tags'] = $entry['tags'];
66 } 66 }
67 67