diff options
Diffstat (limited to 'src/Wallabag/ImportBundle/Import/PocketImport.php')
-rw-r--r-- | src/Wallabag/ImportBundle/Import/PocketImport.php | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/Wallabag/ImportBundle/Import/PocketImport.php b/src/Wallabag/ImportBundle/Import/PocketImport.php index aeccc7bd..b1c5bb00 100644 --- a/src/Wallabag/ImportBundle/Import/PocketImport.php +++ b/src/Wallabag/ImportBundle/Import/PocketImport.php | |||
@@ -48,9 +48,17 @@ class PocketImport implements ImportInterface | |||
48 | /** | 48 | /** |
49 | * {@inheritdoc} | 49 | * {@inheritdoc} |
50 | */ | 50 | */ |
51 | public function getUrl() | ||
52 | { | ||
53 | return 'import_pocket'; | ||
54 | } | ||
55 | |||
56 | /** | ||
57 | * {@inheritdoc} | ||
58 | */ | ||
51 | public function getDescription() | 59 | public function getDescription() |
52 | { | 60 | { |
53 | return 'This importer will import all your <a href="https://getpocket.com">Pocket</a> data.'; | 61 | return 'This importer will import all your <a href="https://getpocket.com">Pocket</a> data. Pocket doesn\'t allow us to retrieve content from their service, so the readable content of each article will be re-fetched by Wallabag.'; |
54 | } | 62 | } |
55 | 63 | ||
56 | /** | 64 | /** |
@@ -196,6 +204,8 @@ class PocketImport implements ImportInterface | |||
196 | */ | 204 | */ |
197 | private function parseEntries($entries) | 205 | private function parseEntries($entries) |
198 | { | 206 | { |
207 | $i = 1; | ||
208 | |||
199 | foreach ($entries as $pocketEntry) { | 209 | foreach ($entries as $pocketEntry) { |
200 | $url = isset($pocketEntry['resolved_url']) && $pocketEntry['resolved_url'] != '' ? $pocketEntry['resolved_url'] : $pocketEntry['given_url']; | 210 | $url = isset($pocketEntry['resolved_url']) && $pocketEntry['resolved_url'] != '' ? $pocketEntry['resolved_url'] : $pocketEntry['given_url']; |
201 | 211 | ||
@@ -241,6 +251,12 @@ class PocketImport implements ImportInterface | |||
241 | 251 | ||
242 | $this->em->persist($entry); | 252 | $this->em->persist($entry); |
243 | ++$this->importedEntries; | 253 | ++$this->importedEntries; |
254 | |||
255 | // flush every 20 entries | ||
256 | if (($i % 20) === 0) { | ||
257 | $em->flush(); | ||
258 | } | ||
259 | ++$i; | ||
244 | } | 260 | } |
245 | 261 | ||
246 | $this->em->flush(); | 262 | $this->em->flush(); |