From 7019c7cf6c6af39c0f458769e20c3f9306477943 Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Thu, 31 Dec 2015 11:24:46 +0100 Subject: Add tagged services for import - list services in /import - add url to import service - ImportBundle routing are now prefixed by /import - optimize flush in each import (flushing each 20 contents) - improve design of each import - add more tests --- src/Wallabag/ImportBundle/Import/PocketImport.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/Wallabag/ImportBundle/Import/PocketImport.php') 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 @@ -45,12 +45,20 @@ class PocketImport implements ImportInterface return 'Pocket'; } + /** + * {@inheritdoc} + */ + public function getUrl() + { + return 'import_pocket'; + } + /** * {@inheritdoc} */ public function getDescription() { - return 'This importer will import all your Pocket data.'; + return 'This importer will import all your Pocket 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.'; } /** @@ -196,6 +204,8 @@ class PocketImport implements ImportInterface */ private function parseEntries($entries) { + $i = 1; + foreach ($entries as $pocketEntry) { $url = isset($pocketEntry['resolved_url']) && $pocketEntry['resolved_url'] != '' ? $pocketEntry['resolved_url'] : $pocketEntry['given_url']; @@ -241,6 +251,12 @@ class PocketImport implements ImportInterface $this->em->persist($entry); ++$this->importedEntries; + + // flush every 20 entries + if (($i % 20) === 0) { + $em->flush(); + } + ++$i; } $this->em->flush(); -- cgit v1.2.3